E
EYALHZ
Guest
I have this code:
it is in a listbox ,it supposed to take a text file from a directory (this is with form load) but when I click on one item in the listbox it put on the to textboxes the information but when I click on another item in the list box it still gives the same text file information,
How could I make a case select for each item in the listbox which will take those five lines(in that code) and will enter its information?!!!
please help me with this , if something is not clear I'll explain my self better.
Code:
'Dim i As String = ListBox1.Items(4)
'Select Case i
' Case 1
Dim lines As String() = File.ReadAllLines(FileName, FileEncoding)
Dim Line As String = lines(Int(Rnd() * (UBound(lines) + 1)))
Dim Pos As Long = Line.IndexOf(" ")
TextBox1.Text = Line.Substring(0, Pos)
TextBox2.Text = Line.Substring(Pos + 1, Line.Length - Pos - 1)
' Case Else
'MessageBox.Show("no item selected", "NO DATA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
'End Select
How could I make a case select for each item in the listbox which will take those five lines(in that code) and will enter its information?!!!
please help me with this , if something is not clear I'll explain my self better.