在C# combobox控件中如果输入“上海”两个字的文本,怎样获取第一个“上”字啊

发布时间:2024-06-04 03:18 发布:上海旅游网

问题描述:

如题,谢谢!!!
对不起
第二个“海”字怎样获取

问题解答:

上:comboBox1.Text.SubString(0, 1);
海:comboBox1.Text.SubString(1, 1);

string str="";
if(combobox.Text!=string.Empty)
str = combobox.Text.Substring(0,1);
这时str的值就是你要获取的"上"字

comboBox1.Text.SubString(1, 1);

combobox.Text[0]=上
combobox.Text[1]=下

热点新闻