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

Re: Copy DataRows to Typed DataSet by Andy

Andy
Mon Aug 09 09:27:06 CDT 2004

<anonymous@discussions.microsoft.com> wrote in message
news:%23HTEgsZfEHA.3476@tk2msftngp13.phx.gbl...
> 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
>

One way would be to pass OrdersTable.DefaultView as a DataView for the
parameter, instead of the typed dataset itself. Then your existing Load
code (except for the Table = part) could simply work against that view
instead of creating one.

Best Regards,

Andy



Re: Copy DataRows to Typed DataSet by anonymous

anonymous
Mon Aug 09 10:40:09 CDT 2004

Thank you, Andy.

"Andy Becker" <x@x.com> wrote in message
news:uqR9zzhfEHA.644@tk2msftngp13.phx.gbl...
> <anonymous@discussions.microsoft.com> wrote in message
> news:%23HTEgsZfEHA.3476@tk2msftngp13.phx.gbl...
> > 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
> >
>
> One way would be to pass OrdersTable.DefaultView as a DataView for the
> parameter, instead of the typed dataset itself. Then your existing Load
> code (except for the Table = part) could simply work against that view
> instead of creating one.
>
> Best Regards,
>
> Andy
>
>