Results 1 to 5 of 5

Thread: search in datagridview

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2009
    Posts
    54

    search in datagridview

    hello
    my program i abot searching in a database viewed by datagridview
    and i want to search within two columns
    i'm using this code to do so:
    Code:
    InstructorsBindingSource.Filter = "PhoneNumber = '" & Trim(ToolStripTextBox1.Text) & "' and instructors = '" & Trim(ToolStripTextBox2.Text) & "'"
    but its not working
    so any suggested ideas

  2. #2
    Addicted Member
    Join Date
    Jul 2009
    Posts
    140

    Re: search in datagridview

    im not sure whether you can write like
    a=b=c format

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: search in datagridview

    Define "not working". Remember that we haven't seen your project in action and we don't know what's in your head, so you need to provide a FULL and CLEAR explanation. EXACTLY what are you doing, EXACTLY what do you expect to happen and EXACTLY what does happen?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Member
    Join Date
    Dec 2009
    Posts
    54

    Re: search in datagridview

    when starting to search the whole statement is highlighted
    what i need is a code for a search box which search within two columns in database
    more:if there is in database name john then when i enter letter o then john appears in datagridview as one of the suggestions
    and at the same time if there is a phone number of 637267382 in database then if i enter 7
    then this number will appear as one of the suggestion in datagridview
    i got a code that only shows suggestions that is only contains what is common betwwen the names and phone number

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2009
    Posts
    54

    Re: search in datagridview

    i solve it using this code
    vb Code:
    1. InstructorsBindingSource.Filter = "PhoneNumber like '%" & Trim(ToolStripTextBox1.Text) & "%' or instructor like '%" & Trim(ToolStripTextBox1.Text) & "%'"

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