01.
Private
Sub
Button1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button1.Click
02.
Dim
aaa
As
Queue
03.
Dim
lc
As
Integer
= 0
04.
Dim
strFilePath
As
String
05.
06.
Dim
aa
As
String
07.
strFilePath = Application.StartupPath +
"\test.txt"
08.
If
Not
File.Exists(strFilePath)
Then
09.
MsgBox(
"File: "
& strFilePath & _
10.
" hasn't been downloaded yet. Preprocessing is being aborted."
, _
11.
MsgBoxStyle.OkOnly,
"File Does Not Exist"
)
12.
End
If
13.
Try
14.
Dim
sr
As
StreamReader =
New
StreamReader(strFilePath)
15.
While
Not
IsNothing(sr.ReadLine)
16.
lc += 1
17.
End
While
18.
MessageBox.Show(lc)
19.
20.
21.
sr.Close()
22.
Catch
23.
MsgBox(
"File: An error occurred while reading "
& strFilePath & _
24.
". Preprocessing is being aborted."
, MsgBoxStyle.OkOnly,
"File Read Error"
)
25.
lc = -1
26.
End
Try
27.
End
Sub