c# - Adding a single row with a single column of one datagridview into another datagridview of multiple column -


i have defined datagridview 5 columns , 1 column ..what want on click of button in datagridview columns, row single column of other datagridview pops up..is possible?..this screenshot of datagridview..

enter image description here

i want add datarow of datagridview 1 column..i know how handle cellevent want addition of datarow 1 column..

hope helps:

private void dgv1_cellcontentclick(object sender, datagridviewcelleventargs e) {     if (e.columnindex == 3)     {         int newrow = dgv2.rows.add();         dgv2.rows[newrow].cells[0].value = dgv1.rows[e.rowindex].cells["stringtext"].value;     }     } 

this should take value stringtext cell , place in first column of newly created row in second grid when button in cell 4 clicked in first grid.

edit:

private void dgv1_cellcontentclick(object sender, datagridviewcelleventargs e)     {         if (e.columnindex == 3)         {             dgv1.rows[e.rowindex].cells["stringtext"].value = dgv2.rows[{y}].cells[0].value;         }         } 

this 1 should set value of cell "stringtext"(which can changed whatever need be) in dgv1 value of cell in dgv2 rowindex {y}.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -