Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...