HighTechTalks DotNet Forums  

how to copy data fom a gridview to another.

Dotnet Framework (WinForms DataBinding) microsoft.public.dotnet.framework.windowsforms.databinding


Discuss how to copy data fom a gridview to another. in the Dotnet Framework (WinForms DataBinding) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
wu jianhua
 
Posts: n/a

Default how to copy data fom a gridview to another. - 04-23-2006 , 04:02 AM






hi,
I have 2 DataGridViews( gridSrc, gridDst), their datatable(DataSource) have
same columns.

DataGridViewRow srcrow = gridSrc.CurrentRow;

How to insert srcrow into gridDst?

thanks.
wu jianhua.



Reply With Quote
  #2  
Old   
wu jianhua
 
Posts: n/a

Default how to copy data fom a gridview to another. 2 - 04-23-2006 , 05:13 AM






private void copyDataGridViewRow( DataGridView src, DataGridView
dst )
{
DataGridViewRow srcrow = src.CurrentRow;

dst.CurrentCell = dst.Rows[ dst.Rows.Count - 1 ].Cells[ 1 ];

DataGridViewRow dstrow = dst.CurrentRow;

dst.BeginEdit( false ); // ?????

for ( int i = 0 ; i < dstrow.Cells.Count ; i++ )
dstrow.Cells[ i ].Value = srcrow.Cells[ i ].Value;

// how to commit here?????

src.Rows.Remove( srcrow );

return;
}


how to commit?

thanks.
wu jianhua.


"wu jianhua" <bigwu99 (AT) hotmail (DOT) com> дÈëÓʼþ
news:%2350YsUrZGHA.3960 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Quote:
hi,
I have 2 DataGridViews( gridSrc, gridDst), their datatable(DataSource)
have
same columns.

DataGridViewRow srcrow = gridSrc.CurrentRow;

How to insert srcrow into gridDst?

thanks.
wu jianhua.





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.