带有单个文本框的数组输入 [英] Array Input with a single textbox
本文介绍了带有单个文本框的数组输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用一个文本框输入数组输入(大于1的数字).我想在列表框上显示它.
I want to take Array Input (more then 1 number) with a single textbox. and i want to show it on a list box. can any buddy help me.
推荐答案
您必须使用输入分隔符(例如空白),然后根据输入文本进行分隔,例如
You have to use a input separator (e.g. blank) and then split according the input text, e.g.
// suppose textBox.Text = "12 1 24 35";
string [] sna = textBox.Text.Split(new char[] {' '});
foreach( string sn in sna )
{
listBox.Items.Add(sn);
}
这篇关于带有单个文本框的数组输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文