How do I filter data on 1 form from selected cell on another form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • timr30017
    New Member
    • May 2010
    • 9

    How do I filter data on 1 form from selected cell on another form?

    I am new to VB.net but I am trying to recreate an old program in .net and learn as I go so any help will be greatly appreciated.

    I have one form with a datagrid that displays a list of 'contacts' with just the minimal basic info in the datagrid.

    I have another form that displays ALL the 'contacts' info.

    I want to double-click on any cell in the datagrid and have the other form load and show ONLY the data for that selected contact on the datagrid form.

    I have no idea where to start but I have at least already figured out how to show only a select set of contacts by setting a filter on the contactstablead apter to "statusid = 4" (An agent).

    Can someone please help me?
  • timr30017
    New Member
    • May 2010
    • 9

    #2
    Originally posted by timr30017
    I am new to VB.net but I am trying to recreate an old program in .net and learn as I go so any help will be greatly appreciated.

    I have one form with a datagrid that displays a list of 'contacts' with just the minimal basic info in the datagrid.

    I have another form that displays ALL the 'contacts' info.

    I want to double-click on any cell in the datagrid and have the other form load and show ONLY the data for that selected contact on the datagrid form.

    I have no idea where to start but I have at least already figured out how to show only a select set of contacts by setting a filter on the contactstablead apter to "statusid = 4" (An agent).

    Can someone please help me?
    Update:

    Ok I figured out the hard part and here is my code:
    Form1.ContactsB indingSource.Fi lter = "contactid = " & Me.ContactsData GridView.Curren tCell.Value
    Form1.Show()

    But it ONLY works if I click on the ContactID field. Dbl-clicking any other field causes the wrong value to be sent. How can I force it to send the contactID value regardless of which actual cell I dbl-click on that row?

    Comment

    • Aimee Bailey
      Recognized Expert New Member
      • Apr 2010
      • 197

      #3
      I've attached a small project example of filtering the datagridview, through a child window, hope it helps :)
      Attached Files

      Comment

      Working...