C#窗体设计:[26]ComboBox读入数据

2024-10-13 11:48:30

1、新建一个C#应用程序,应用程序命名为ComboBoxDialog。

C#窗体设计:[26]ComboBox读入数据

3、双击窗体添加响应函数Form1_Load(),响应函数Form1_Load()中添加一下代艨位雅剖码:pri即枢潋雳vate void Form1_Load(object sender, EventArgs e) { StreamReader stream = File.OpenText("guojia.txt"); String str; while ((str = stream.ReadLine()) != null) { comboBox1.Items.Add(str); } }

C#窗体设计:[26]ComboBox读入数据

5、程序运行如下

C#窗体设计:[26]ComboBox读入数据
猜你喜欢