PDA

Click to See Complete Forum and Search --> : Help with DataGridView


daimous
Dec 12th, 2007, 08:15 PM
Hi guys! Help please...I have 2 DataGridView, DataGridView1 and DataGirdView2. What I want is, when i double click an item on DataGridView1 I want that item to be copied to DataGridView2..How is this posible? by the way, the 2DataGridView are initially dont have columns defined but when my windows form is load DataGridView1 is filled up by the result of my sql query so the columns in DataGridView1 is defined. Help please..Thanks in advance!

jmcilhinney
Dec 12th, 2007, 08:48 PM
You get the bound DataRowView from the Current property of your BindingSource. You then call the AddNew method of the second BindingSource and set the fields of the new DataRowView.

daimous
Dec 12th, 2007, 09:04 PM
Whoowwww...Thanks for that John..but, im just new to DataGrid and honestly, i cant understand the terms...Can you please explain it further, if you can still..or if posible can you please give an example, it may not be exact to what im asking but it could be something that has relevant to my problem...Thanks in advance!

jmcilhinney
Dec 12th, 2007, 09:18 PM
This has very little to do with the DataGridView (and nothing to do with the DataGrid). You should be binding your DataTables to BindingSource objects, which in turn should be bound to the grids. Everything I said relates to the BindingSource and DataRowView classes. If you want to know about the BindingSource class, its Current property or its AddNew method (you know what I'm going to say don't you) you should read the documentation.

daimous
Dec 12th, 2007, 09:26 PM
This has very little to do with the DataGridView (and nothing to do with the DataGrid).
Thats the proof for this
im just new to DataGrid:D

(you know what I'm going to say don't you)

Yah.... :D read the MSDN... :thumb:


Thanks for that John...I'll give it a try..

jmcilhinney
Dec 12th, 2007, 09:30 PM
Thanks for that John...I'll give it a try..When you have, if you still can't get it then post what you've done and I'll be glad to help. I'm always keen to see people have a shot themselves first though. :)

daimous
Dec 13th, 2007, 02:17 AM
No prob..I'm always keen to see people have a shot themselves first though. INDEED! ..Infact everytime i post a questions/problem its always expected that you have always the answer, it may not be the exact answer/solution but still it really helps a lot and really appreciate it!