This is copying/moving from one DataGrid to another, but you should be able
to take this and modify for your purposes. Comments are interspersed below.
I hope this may help
Private Sub cmdProc1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdProc1.Click
'variables - dgBatches is a DataGrid we select FROM
Dim currentRows As Integer = dgBatches.CurrentRowIndex()
Dim moveRow As DataRow
'move data - dsOracle is a DataSet that I am using TO
moveRow = Me.dsOracle.Tables("PROCESS").NewRow
moveRow.Item("BATCH_NUM") = dgBatches.Item(currentRows, 0)
moveRow.Item("JNL_CODE") = dgBatches.Item(currentRows, 1)
moveRow.Item("DESC") = dgBatches.Item(currentRows, 2)
moveRow.Item("AMOUNT") = dgBatches.Item(currentRows, 3)
dsOracle.Tables("PROCESS").Rows.Add(moveRow)
'remove... - dtDisplay1 is the Table that dgBatches is derived from
Dim MatchRows() As DataRow = dtDisplay1.Select("BATCH_NUM='" _
& dgBatches.Item(currentRows, 0) & "'")
Dim MatchRow As DataRow
For Each MatchRow In MatchRows
dtDisplay1.Rows.Remove(MatchRow)
Next
'refresh boxes
Me.dgBatches.Refresh()
Me.dgToBeProcessed.Refresh() - DataGrid dsOracle("PROCESS") feeds
End Sub
"Arvi" wrote:
> Hi,
>
> I have a db design as
>
> table 1
>
> id
> length
>
>
> table 2
>
> id
> startposition
> length
>
>
> im loading the data on the grid as
>
> grid1 (for table1)
>
> 1 12
> 2 10
> 3 34
>
>
>
>
> grid2(table2)
>
> id, startpos, length
> 1 1 12
> 2 13 10
> 3 23 34
>
>
> is it possible to copy the record in grid1 to the table2 ?
>
> im loading the grid with the Dataview.
>
>
>
|