8 Comments

  • Roy, this post is in my "Gold" folder and I will definitely be going back to it. Thanks.

  • Nice share Roy, appreciate it!

  • Excellent stuff on the delete cancellation in a datagrid. i have been searching for info for many days now. Thanks.

  • Hi,

    This is a very useful solution. but i don't get the keydown events fired from datagrid. please help me out?

    LLara

  • Thank you,



    Please get a job at Microsoft...

  • Unfortunately this solution only works when your displayed sort order matches your tables primary key.



    ie: If my customer table has a pk called "ID" but the navigational order for the client is by "Name" (and supports duplicate entries) then this solution fails since there is no way to map the binding position returned in a dataview sorted by ID to the binding position of the table (or another dataview) sorted by NAME.



    This has bee a source of great frustration for me since the .NET platform seems to have no mechanism for moving the binding position of a table to the location of a datarow returned in a [datatable].rows.find().



    The only workaround I've come up with is to create a hidden combobox called lbGetIndexOf whose datasource is bound to the table and whose display and valumenbers are bound to the tables primary key. I can then sync the binding position by doing a:



    bm.position = lbGetIndexOf.FindStringExact(key)

  • err: thats a hidden LISTBOX not combobox - although either control would work

  • does lesson 4 apply to my scenario?

    I have also started using the BindingSource with great success.
    I have a scenario that I did find though, that seemed a limitation.

    I have Patients->Theatre->Procedure set up with the arrow head meaning the many of a 1 to many.

    So a Patient is selected, I bind the Theatre DataSource and the first row of the Theatre data is show correctly - cool.

    Unfortunately any controls like say a Procedure Type Combo do *not* have their selected value set correctly (despite doing the right thing in advanced binding settings ie
    procedure1Combo selected value bound to the FK in the theatre DataSource.

    I think it may be a limitation in that the Patient is the 3rd link in the chain so to speak and does not pick up the change in binding source.......still investigating.

    Maybe I have to check out the BindingManager a bit more?

Comments have been disabled for this content.