have a form developed using the Dataform wizard (VS 2003). The Form shows Master-Detail data. The details are showen in a Datagrid. The form automatically loads the data in the Form_load event. Now I want to store the data from the datagrid to a datatable.
I am using following code to get the details showen in the datagrid into a dataview.
The objdsInvoice is the dataset that holds the Invoice And Invoice_Item data.
Dim DV As DataView
Dim tempDT As DataTable
tempDT = objdsInvoice.Tables("INVOICE_ITEM").Copy
tempDT.DefaultView.RowFilter = "INVOICE_NUMBER = " & Val(editINVOICE_NUMBER.Text)
'objdsInvoice.Tables("INVOICE_ITEM").DefaultView.RowFilter = "INVOICE_NUMBER = " & Val(editINVOICE_NUMBER.Text)
dtBeforeEdit = tempDT.DefaultView
Once I got all the data in dtBeforeEdit dataview I am retrieving the data using loop -
For Each dr As DataRow In dtAfterEdit.Rows
.....
....
Perform action on the rows.
Next
Is there any better way to get the datagird values that are currently displayed into a datatable.
The datagrid is bound to the details table in the Master-detail type dataset.
Please see the attached screenshot for my form.
I am using following code to get the details showen in the datagrid into a dataview.
The objdsInvoice is the dataset that holds the Invoice And Invoice_Item data.
Dim DV As DataView
Dim tempDT As DataTable
tempDT = objdsInvoice.Tables("INVOICE_ITEM").Copy
tempDT.DefaultView.RowFilter = "INVOICE_NUMBER = " & Val(editINVOICE_NUMBER.Text)
'objdsInvoice.Tables("INVOICE_ITEM").DefaultView.RowFilter = "INVOICE_NUMBER = " & Val(editINVOICE_NUMBER.Text)
dtBeforeEdit = tempDT.DefaultView
Once I got all the data in dtBeforeEdit dataview I am retrieving the data using loop -
For Each dr As DataRow In dtAfterEdit.Rows
.....
....
Perform action on the rows.
Next
Is there any better way to get the datagird values that are currently displayed into a datatable.
The datagrid is bound to the details table in the Master-detail type dataset.
Please see the attached screenshot for my form.