Hello,
I developed a custom Windows control that displays a data grid of all orders
for a customer.
Since the control only needs to use the Orders table within the parent data
set (along with the customer ID to filter), it seemed logical to only give
the control what it needs. That's my reasoning for the code below...
\\\
Public Sub New(ByRef Orders As myTypedDataSet.OrdersTable, _
ByVal CustomerID As Integer)
MyBase.New()
InitializeComponent()
dsLocal.Orders = Orders
_Customer_ID = CustomerID
End Sub
Private _CustomerID As Integer
Private dsLocal As myTypedDataSet
Private Sub ctlOrdersForCustomer_Load(ByVal _
sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
myDataView.Table = dsLocal.Orders
myDataView.RowFilter = "CustomerID = " & _CustomerID.ToString
myDataView.Sort = "OrderDate DESC"
myGrid.DataSource = myDataView
End Sub
///
My problem is that I can't pass the Orders table as an argument because it
is part of a typed data set. VS.NET complains about dsLocal.Orders being
read-only in the following statement of the constructor:
dsLocal.Orders = Orders
How can I set the local typed dataset table to the incoming parameter? I've
also tried the Copy, ImportRow, and LoadDataRow methods with no luck. Does
anyone know how this can be done?
Thank you very much!
Eric