从文件中读取值并将它们放在不同的文本框中并递增它们

时间:2014-04-20 18:55:14

标签: c# .net windows

 private void button1_Click(object sender, EventArgs e)
                 {
                     int counter = 0;
                     string line;

                 // Read the file and display it line by line.
                 System.IO.StreamReader file = new System.IO.StreamReader("E:\\complier.txt");

                 while ((line = file.ReadLine()) != null)
                 {
                     string[] la = line.Split(';');

                     string firstName = la[0];
                     string lastName = la[1];
                     //userBox.Text = firstName;
                     //passBox.Text = lastName;

                     counter++;
                 }

1 个答案:

答案 0 :(得分:0)

只是猜测:

 userBox.Text += firstName + Environment.NewLine;
 passBox.Text += lastName + Environment.NewLine;

这不是我们玩猜谜游戏的地方,但是......