Results 1 to 9 of 9

Thread: how to create search for datagrid

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    20

    how to create search for datagrid

    Is there any way to create a search using a text box where someone could type in part of what they are looking for and it can search one field in my datagrid and if it finds the search criteria, go to that record in the grid ?

    Any help is greatly appreciated. Thanks

    --
    Tony

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    20

    clarification

    I thought I would clarify what I am looking to do.
    I do not want to filter the recordset on a search value.

    I want to look for a search string in a field of my dataset, and if found, move to that record in my datagrid. I am searching based on partial values also. So if a record is as follows:
    field 1=ENT
    field 2=Backing Soda

    I would like to search field 2 for "soda" and move to the first record containing that value. If I click again to search it will look from that point in the database on, and if it is found move to that record. And on and on until it hits the bottom of the dataset and them display "no more records found" kind of thing

    Can this be done ?
    Thanks

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    look at the documentation for a dataview. Then bind the grid to that.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    20
    I did find the information on dataview in the vb.net documentation but it seems that I can only search by a whole field and not by part.

  5. #5
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    No, you can specify something like this:
    field 2 LIKE %Soda%

    I believe. I haven't tested that code, but something like it should work.

    This link should help start you out...
    http://p2pforum.wileypub.com/topic.asp?TOPIC_ID=6537

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    20
    I appreciate the help but I am not looking to filter the records.

    All I want to do is look for the search term in a field then if found go to that record.

    I do not want to do any sorting selecting or anythign of that kind

  7. #7
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    did you mean, search an exisiing populated datagrid and position to that record? and perhaps highlight it?

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Dec 2003
    Posts
    20
    That is correct. I have populated my datagrid upon program load and just want to search the grid for the search text and goto that record if found

  9. #9
    Addicted Member
    Join Date
    Jul 2002
    Posts
    135

    Re: how to create search for datagrid

    Anyone have a solution for this?
    Hello? Underpaid code monkey speaking...

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