IT KNOWLEDGE

IT KNOWLEDGE
BC

Monday, May 19, 2014

Full-Text Search From Listbox (VB.NET)

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:


  1. TextBox1: 
    • Text=""
    • Name="TxtSearch"
    • Font Size=12
  2. Button1
    • Text="Search"
    • Name="CmdSearch"
    • Font Size=12
  3. ListBox1:
    • Name:"DataListBox1"
    • Font Size=12
  4. ListBox2
    1. Name="DataListBox2"
    2. 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



Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: itech-9999

0 comments: