E
extream87
Guest
Hello im here again with one last question to complete my project.
I need to search in listbox using textbox.
Imagine my listbox contais:
Andry
Andry A
Best
Camaro
Caliente
When i type ca in textbox, listview shows camaro and caliente removing all other words.
If i type an listbox shows andry and andry a removing all other words.
Im using this leshay code to insert items from txt file to my listbox
Option Strict On
Option Explicit On
Public Class Form1
Dim fn As String = "C:\Users\lesha\Desktop\testfile.txt"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim lines() As String = IO.File.ReadAllLines(fn)
ListBox1.DataSource = lines
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
Dim s() As String = ListBox1.SelectedItem.ToString.Split(New String() {" ", "-"}, StringSplitOptions.RemoveEmptyEntries)
TextBox1.Text = s(0)
TextBox2.Text = s(1)
End Sub
End Class
Continue reading...
I need to search in listbox using textbox.
Imagine my listbox contais:
Andry
Andry A
Best
Camaro
Caliente
When i type ca in textbox, listview shows camaro and caliente removing all other words.
If i type an listbox shows andry and andry a removing all other words.
Im using this leshay code to insert items from txt file to my listbox
Option Strict On
Option Explicit On
Public Class Form1
Dim fn As String = "C:\Users\lesha\Desktop\testfile.txt"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim lines() As String = IO.File.ReadAllLines(fn)
ListBox1.DataSource = lines
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
Dim s() As String = ListBox1.SelectedItem.ToString.Split(New String() {" ", "-"}, StringSplitOptions.RemoveEmptyEntries)
TextBox1.Text = s(0)
TextBox2.Text = s(1)
End Sub
End Class
Continue reading...