读取文本文件并在到达文件末尾时提示

时间:2014-03-08 21:21:53

标签: vb.net messagebox readline

Private Sub btnnext_Click(sender As Object, e As EventArgs) Handles btnnext.Click    
   lblfirst.Text = objstreamreader.ReadLine
   lblMiddle.Text = objstreamreader.ReadLine
   lbllast.Text = objstreamreader.ReadLine
   lblempnum.Text = objstreamreader.ReadLine
   lbldept.Text = objstreamreader.ReadLine
   lbltele.Text = objstreamreader.ReadLine
   lblext.Text = objstreamreader.ReadLine
   lblemail.Text = objstreamreader.ReadLine
   lblsal.Text = objstreamreader.ReadLine
   Label10.Text = objstreamreader.ReadLine
   If (objstreamreader.ReadLine) = -1 Then
      'no department has been selected
      MessageBox.Show("There are no more records on file")
   End If
End Sub

1 个答案:

答案 0 :(得分:0)

而不是MessageBox.Show("There are no more records on file")MsgBox("There are no more records on file")怎么样?