我想要一个消息框弹出显示从用户接受的字符串的第一个字符通过文本框,当用户单击消息框的确定按钮时,下一个字符弹出消息直到达到空。无法从字符转换为字符串
我已经创建了这个程序,但由于显而易见的原因,它给出了以下错误: “无法从'字符'转换为'字符串'” 请提出一些更改。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace loop_Message
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void submit_Click(object sender, EventArgs e)
{
string str;
str = stringTxt.Text;
for (int i = 0; str[i] != null; i++)
{
MessageBox.Show(str[i]);
}
}
}
}
Consder读取C#和C++之间的区别 - 其中一种语言有0个终止字符串,另一个没有。 – 2013-02-26 07:59:24
试试这个MessageBox.Show(str [i] .ToString()); – 2013-02-26 08:02:18