In this tutorial, I will show you how to create an application to using Full-Text Search data from ListBox. I'll use 4 controls to add on form:
- TextBox1:
- Text=""
- Name="TxtSearch"
- Font Size=12
- Button1
- Text="Search"
- Name="CmdSearch"
- Font Size=12
- ListBox1:
- Name:"DataListBox1"
- Font Size=12
- ListBox2
- Name="DataListBox2"
- Font Size=12
Code
Public Class FullTextSearchListbox
Private Sub FullTextSearchListbox_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With DataListBox1.Items
.Add("Business Management")
.Add("Computer Science")
.Add("Tourism Study")
.Add("Law")
.Add("Marketing")
.Add("Electronic")
.Add("Management")
.Add("Engineering")
End With
End Sub
Private Sub CmdSearch_Click(sender As Object, e As EventArgs) Handles CmdSearch.Click
DataListBox2.Items.Clear()
Dim count As Integer = (DataListBox1.Items.Count - 1)
Dim words As String
For a = 0 To count
words = DataListBox1.Items.Item(a)
If InStr(words.ToLower, TxtSearch.Text.ToLower) Then
DataListBox2.Items.Add(words)
End If
Next
End Sub
End Class
0 comments:
Post a Comment