Results 1 to 8 of 8

Thread: [RESOLVED] compare listbox and textbox

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2008
    Posts
    40

    Resolved [RESOLVED] compare listbox and textbox

    hi

    in my project i have
    a list box
    a textbox
    and a command button

    in the listbox i have written some names like
    jhon
    eddie
    martin

    i want when i write a name in the textbox check the name is on the listbox and if the name is on the listbox then run the commandbutton

    can any body help me

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: compare listbox and textbox

    Something like this...????
    Code:
    Private Sub Command1_Click()
    MsgBox "hello"
    End Sub
    
    Private Sub Text1_Change()
    If Trim(Text1.Text) = "" Then Exit Sub
    For i = 0 To List1.ListCount
        If LCase(Trim(Text1.Text)) = lcase(List1.List(i)) Then
        Command1_Click
        Exit Sub
        End If
    Next i
    End Sub

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2008
    Posts
    40

    Re: compare listbox and textbox

    bro this code work bt

    i want when i write a name in the textbox check the name is on the listbox or not and if the name is on the listbox then run the commandbutton if not dnt run the command button

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: compare listbox and textbox

    That is what my code is doing...
    Have you checked it...????

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2008
    Posts
    40

    Re: compare listbox and textbox

    yes i hav check it bt i works when i type anything in the textbox :S

  6. #6
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: compare listbox and textbox

    I think, you are saying that, the code is executing when anything is typed into the textbox. Yes, it does..!!! When you type anything into the textbox, the program will check the listbox for any similar entries and if an entry is found, the button's click event is called....

    Isn't this what you are looking for??? If not, then specify the details, clearly...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  7. #7

    Thread Starter
    Member
    Join Date
    Aug 2008
    Posts
    40

    Re: compare listbox and textbox

    ok i got it thanks a lot bro

  8. #8
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: compare listbox and textbox

    ok i got it thanks a lot bro
    You are welcome...
    If your problem is solved, then mark the thread as RESOLVED

    -Best Wishes
    Akhilesh

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width