Cor,
Thanks for responding. I've extracted some code and posted it below.
This is the code that exhibits the problem of showing rows in dgOrderDetail
even
though there are no rows in the dgOrders because the RowFilter of mdvOrders
returns no rows.
I included two event responses that may have a bearing as they respond to
events fired when the Orders row changes or when the OrderDetail Column
changes.
Note that I have the Invoice and IvoiceDetail datagrids bound through the
mdvOrders dataview and they work just fine. That makes it more difficult to
figure why the OrderDetail datagrid is not working property.
Any insights will be greatly appreciated.
Thanks,
Dave
Friend mdvOrders, mdvCustomers As DataView
Friend WithEvents mcurmgrOrders As CurrencyManager
Private WithEvents mOrderDetailTable As dsOrder.OIPLineItemDataTable
Private mOrderRow As dsOrder.OrderInProcessRow
Private Sub frmWebOrders_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Create the dataviews
mdvOrders = New DataView(dsOrder1.OrderInProcess)
mdvCustomers = New DataView(DSCustomer1.Customer)
'Assign the data sources
dgOrders.DataSource = mdvOrders
dgOrderDetail.DataSource = mdvOrders
dgOrderDetail.DataMember = "OrderInProcessOIPLineItem"
dgInvoices.DataSource = mdvOrders
dgInvoices.DataMember = "OrderInProcessInvoice"
dgInvoiceDetail.DataSource = mdvOrders
dgInvoiceDetail.DataMember =
"OrderInProcessInvoice.InvoiceInvoiceLineItem"
mOrderDetailTable = dsOrder1.OIPLineItem
mcurmgrOrders = Me.BindingContext(mdvOrders)
'Other initialization code
'
'***********************
End Sub
'****** mcurmgrOrders_CurrentChanged *************
' Sets mOrderRow to the newly selected order. mOrderRow used by numerous
functions in response to
' control events that work on the curently selected order.
'
' Sets filter for the Customer Dataview to the customer ID for the current
order. This is to display customer info
' for the current order in simple bound controls that are bound to the
Customer dataview
'*************************************************************
Private Sub mcurmgrOrders_CurrentChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles mcurmgrOrders.CurrentChanged
If Not mcurmgrOrders.Current Is Nothing Then
mOrderRow = mcurmgrOrders.Current.Row
mdvCustomers.RowFilter = "ID = '" &
mcurmgrOrders.Current("CustomerID") & "'"
End If
End Sub
'************ mOrderDetailTable_ColumnChanged ****************
' Checks of one of several columns have been changed
' If yes, calculates Total Weight and TotalPRice
' then recalcs overall totals for the order
'**************************************************************
Private Sub mOrderDetailTable_ColumnChanged(ByVal sender As Object, _
ByVal e As System.Data.DataColumnChangeEventArgs) Handles
mOrderDetailTable.ColumnChanged
Select Case e.Column.ColumnName
Case "QtyOrdered","Price","Weight"
If Not IsDBNull(e.Row("QtyOrdered")) And Not
IsDBNull(e.Row("Price"))Then
e.Row("PriceTotal") = e.Row("QtyOrdered") * e.Row("Price")
End If
If Not IsDBNull(e.Row("QtyOrdered")) And Not
IsDBNull(e.Row("Weight"))then
e.Row("WeightTotal") = e.Row("QtyOrdered") *
e.Row("Weight")
End If
e.Row.EndEdit()
CalcOrderTotals()
End Select
End Sub