2014-04-20 18 views
0
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++; 
       } 
+0

什么的问题??告诉你的问题? –

+0

问题在哪里 –

回答

0

只是胡乱猜测:

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

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

+0

对不起,但你的猜测不起作用 – Fex

+0

嗯,如果你能清楚地知道你需要什么,那真的会有所帮助。如果你想收集这些名字,如果你的文件阅读代码有效,我的代码就可以工作。是否(阅读您期望的行)?你是否正在与我们最好的朋友调试器一起加入代码?你想增加什么? – TaW

+0

实际上,我想要读取具有“用户名,通行证”等文本并希望在一个文本框中显示用户名并通过其他文本框的文件,并在第二个按钮单击它时将读取第二行值 – Fex

相关问题