PC Review


Reply
Thread Tools Rate Thread

Copy from one grid to other

 
 
Arvi
Guest
Posts: n/a
 
      16th Nov 2006
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.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?V2FsdGVyIEhhcnJpcw==?=
Guest
Posts: n/a
 
      20th Nov 2006
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.
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy from excell to word without grid duckwinter Microsoft Excel Misc 2 3rd Jul 2009 11:26 PM
Copy from one grid to other Arvi Microsoft Dot NET 1 20th Nov 2006 07:34 PM
Macro to Copy Grid Header =?Utf-8?B?SmFzb24gSGVpZGVy?= Microsoft Excel Programming 1 23rd Mar 2006 12:36 AM
copy and paste from a grid ric waters Microsoft Excel Programming 0 16th Sep 2004 06:23 PM
copy form or grid in IDE Mtcc Microsoft Dot NET Compact Framework 0 2nd May 2004 12:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:30 AM.