S
Shooter4Life8
for some reason when i try to use a "using" statment i get an error
saying.
"Name 'Using' is not declared."
does that mean that i need to inheirit or import from a class? Im
trying to use it to read from a file. The file format is as follows.
The information I want are the group numbers
----------------------
| GroupNumber |
----------------------
| 6152 |
----------------------
| 4253 |
----------------------
| 1151 |
----------------------
| ABC1883 |
----------------------
| ABC2135 |
----------------------
| 785HBLA |
----------------------
| 785HBLA |
----------------------
The code I will be modifying to read is as follows. Is there a better
way to go about this? Or should I just work with this? (this code is
from msdn. and is used for commadilimited files)
Visual Basic Copy CodeUsing MyReader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser("C:\testfile.txt")
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
Dim currentField As String
For Each currentField In currentRow
MsgBox(currentField)
Next
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Line " & ex.Message & _
"is not valid and will be skipped.")
End Try
End While
End Using
Thanks!
saying.
"Name 'Using' is not declared."
does that mean that i need to inheirit or import from a class? Im
trying to use it to read from a file. The file format is as follows.
The information I want are the group numbers
----------------------
| GroupNumber |
----------------------
| 6152 |
----------------------
| 4253 |
----------------------
| 1151 |
----------------------
| ABC1883 |
----------------------
| ABC2135 |
----------------------
| 785HBLA |
----------------------
| 785HBLA |
----------------------
The code I will be modifying to read is as follows. Is there a better
way to go about this? Or should I just work with this? (this code is
from msdn. and is used for commadilimited files)
Visual Basic Copy CodeUsing MyReader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser("C:\testfile.txt")
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
Dim currentField As String
For Each currentField In currentRow
MsgBox(currentField)
Next
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Line " & ex.Message & _
"is not valid and will be skipped.")
End Try
End While
End Using
Thanks!