日期:2014-05-18  浏览次数:20574 次

winform取出文字问题
textbox1里面有下面这些数据,我想让textbox2显示123,点一下按钮之后显示456,怎么实现啊?
123
456
789
abc

------解决方案--------------------
在 textBox 中有 这样的值?123 456 789 abc?

好象是做不到的吧? 建议换个控件
用listBox 应该可以作到
用他的 selectedIndexChange 事件 在里面 判断 selectedIndex 的值 然后显示 就好拉


我是小菜鸟! 说的不好清见谅, 希望能够帮到你!
------解决方案--------------------
C# code
private string[] texts = new string[] { "123", "456", "789", "abc" };
private int index = 0;
private void button1_Click(object sender, EventArgs e)
{
    textBox1.Text = texts[index];
    index = (index + 1) % texts.Length;
}