Datagrid binding problem

  • Thread starter Thread starter Guest
  • Start date Start date
Hi all,

I have a dataset that contain 2 tables and a relationship between them
(master detail).
I bind this dataset to a form that include some textboxes that bind to the
parent record, and a datagrid that is binded to the detailed records.

Here is the code:

Code:
Private Sub FillHeader(ByRef dsDataSet As DataSet)
Try
txtKey.DataBindings.Add(New Binding("text", dsDataSet , "header.key"))
txtNo.DataBindings.Add(New Binding("text", dsDataSet , "header.no"))
Catch ex As Exception
HandleExceptions(ex)
End Try
End Sub

Code:
Private Sub FillLines(ByRef dsDataSet As DataSet)
Try
dsDataSet.Tables("lines").Columns("key").ColumnMapping =
MappingType.Hidden
dsDataSet.Tables("lines").Columns("product_id").ColumnName = "Product
Id"
dsDataSet.Tables("lines").Columns("quantity").ColumnName = "Quantity"
dgLines.SetDataBinding(dsDataSet.Tables!lines, "HeaderLines")
Catch ex As Exception
HandleExceptions(ex)
End Try
End Sub

The sub I use to navigate is (For example I put only the next command):

Code:
Sub cmdNext() Implements ICommandNext.cmdNext
Try
bdRecordNavigator = BindingContext(dsHeader, "header")
bdRecordNavigator.Position += 1
Catch ex As Exception
HandleExceptions(ex)
End Try
End Sub

My problem happens when I navigate between the master records. The textboxes
show the correct values, but there is no change in the datagrid. What do I
miss here, that this sub will handle the datagrid as well?

Thanks
 
Ken Tucker,
Thanks for your reply
The tips you supplyed heled me a lot.

All I had to do was to add a line before the catch statement that solved the
whole problem:
dgItems.SetDataBinding(dsPOHeader, "purchase_order_header.POHeaderLines")



Thanks again

Ohad
 
Ken Tucker,
Thanks for your reply
The tips you supplyed heled me a lot.

All I had to do was to add a line before the catch statement that solved the
whole problem:
dgLines.SetDataBinding(dsDataSet, "header.HeaderLines")



Thanks again

Ohad
 
Back
Top