I'm trying to read a textfile line by line, because each line is a data for mi program (integer numbers).
After reading each number, I want to add the number to a textbox and then send the "Enter" key to that textbox. Read the next number and send the enter key...
I'm trying to do this but it seems there is some kind of error:
Dim Nombre_Archivo As String = OpenFileDialog1.FileName
Dim TextLine As String
If System.IO.File.Exists(Nombre_Archivo) = True Then
Dim ObjReader As New System.IO.StreamReader(Nombre_Archivo)
Do While ObjReader.Peek() <> -1
'TextLine = TextLine & ObjReader.ReadLine() & vbNewLine
TEXTBOX_NumeroSalido.Focus()
TextLine = ObjReader.ReadLine() & vbNewLine
LISTBOX_Consejo.Items.Add(TextLine)
TEXTBOX_NumeroSalido.Text = TextLine
SendKeys.Send("{ENTER}")
Loop
'TextLine = ObjReader.ReadLine()
'TextBox1.Text = TextLine
End If
After reading each number, I want to add the number to a textbox and then send the "Enter" key to that textbox. Read the next number and send the enter key...
I'm trying to do this but it seems there is some kind of error:
Dim Nombre_Archivo As String = OpenFileDialog1.FileName
Dim TextLine As String
If System.IO.File.Exists(Nombre_Archivo) = True Then
Dim ObjReader As New System.IO.StreamReader(Nombre_Archivo)
Do While ObjReader.Peek() <> -1
'TextLine = TextLine & ObjReader.ReadLine() & vbNewLine
TEXTBOX_NumeroSalido.Focus()
TextLine = ObjReader.ReadLine() & vbNewLine
LISTBOX_Consejo.Items.Add(TextLine)
TEXTBOX_NumeroSalido.Text = TextLine
SendKeys.Send("{ENTER}")
Loop
'TextLine = ObjReader.ReadLine()
'TextBox1.Text = TextLine
End If