To remove syntax errors, I made the following changes.
1. Added a reference to
System.Windows.Forms.
2. Added an
Import System.Windows.Forms
.
3. Added an
Import System.IO
.
4. Added
CChar(" ")
to
.Split
method parameter to cast the parameter to the
Char
data type.
5. Put the code inside a method named
Test
.
Imports System.Windows.Forms
Imports System.IO
Module Module1
Sub Test()
Dim FILE_NAME As String = Application.StartupPath & "\textfile.txt"
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Dim cons1 As String = objReader.ReadLine
objReader.Close()
Dim cons() As String
cons = cons1.Split(CChar(" "))
End Sub
End Module