mcerk Posted December 13, 2004 Posted December 13, 2004 I have 2 tables in my Dataset. They are related with a constraint. I use Datagrid to move thru records and textboxes to edit values. Textbox Databindig text properties are set to my Dataset. When I set Databinding to the DataGrid everything works fine. Me.DataGrid1.SetDataBinding(Me.DataSet, "Table1") My textboxes show current record selected in datagrid. OK. that is fine. But I want to manually fill some other records. That is why I would like to find out "Table1.id" field of selected DataGrid record. How can I do this? BTW: this code doesn't work when DataGrid.SetDataBinding is set, but works, if DataGrid.SetDatabinding is not set!!!!!!!! 'I need this code, to figure out 'Table1.id' of selected record. dim variableID as Integer variableID = Me.DataSet.Table1.Rows(Me.BindingContext(Me.DataSet.Table1).Position).Item("id") So my question is, how can I change code for variableID, that it will worke while datagrid Databinding is set???? tx matej Quote
MrMucox Posted December 14, 2004 Posted December 14, 2004 I believe what you are looking for is: variableID = Me.BindingContext(Me.DataSet, "Table1").Current("id") Me.BindingContext(Me.DataSet, "Table1") is not the same as Me.BindingContext(Me.DataSet.Table1), and will be different binding contexts Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.