i need helppppppp

    Dim Search As String
    Dim Where As Long

    Search = listbox1

    Where = InStr(rt2.Text, Search)

    If Where <> 0 Then

        rt2.Focus()
        rt2.SelectionStart = Where - 1
        rt2.SelectionLength = Len(Search)

        rt1.Text = Search


    Else
        MsgBox("String not found.")
    End If

i am making a project in which textbox will search the items available in list box ......... suppose my listbox has 123 or 5584 then it will process else error

please i need urgent help

Hi

If I understand correctly, you want to search the list box for an entry that has been made in a text box?

if so, the following should point you in the right direction. It uses the ListBox.Items.Contains method to determine if the list box contains the value:

If ListBox1.Items.Contains(TextBox1.Text) Then
    MessageBox.Show("Found")
Else
    MessageBox.Show("Not Found")
End If

HTH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.