Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27201

VS 2010 SendKeys and Reading Textbox file line by line

$
0
0
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

Viewing all articles
Browse latest Browse all 27201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>