bindingsource.Find on several fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NicSM
    New Member
    • Oct 2007
    • 2

    #1

    bindingsource.Find on several fields

    Hi

    Can anyone please help me with this problem?

    I'm working with a master/detail windows form in c# and I'm trying to locate a record in the detail section with respect to a set of primary keys.

    Initially I was using
    Code:
    bindingsource.Position = datatable.DefaultView.Find(primaykey_objects)
    to position to the record but the method datatable.Defau ltView.Find() returns the index of the record within the whole datatable and not within the detail section.

    My ideal solution would have been to use bindingsource.F ind on several fields. How can I do that? Or is there another way to my problem?

    Thank you.
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Originally posted by NicSM
    Hi

    Can anyone please help me with this problem?

    I'm working with a master/detail windows form in c# and I'm trying to locate a record in the detail section with respect to a set of primary keys.

    Initially I was using
    Code:
    bindingsource.Position = datatable.DefaultView.Find(primaykey_objects)
    to position to the record but the method datatable.Defau ltView.Find() returns the index of the record within the whole datatable and not within the detail section.

    My ideal solution would have been to use bindingsource.F ind on several fields. How can I do that? Or is there another way to my problem?

    Thank you.
    You can use the Filter property to filter out the data based on multiple rows.
    Have a look at this property in msdn

    cheers

    Comment

    • NicSM
      New Member
      • Oct 2007
      • 2

      #3
      Maybe I did not explain myself very well...

      I want to be able to position to a row that has several fields as primary keys, not to find several rows with respect to a certain condition.

      In my case, the Filter method will return only 1 row in the bindingsource, while I just need to set the current position to the row.

      Am I making any sense to you?

      Comment

      Working...