Click here to Skip to main content
14,300,872 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi, I`m studing C# window application, I have question of it.
I am not good at English, but I would appreciate it if you could help.(T A T)

I have to forms.
All of forms have DataGridView, and I want to get data from form1`s cell.
Next, I want to pass data(text) into form2`s label without mouseClick.
But I don`t know where I writing out code.

What I have tried:

I find 'GridView1.Rows [Gridview1.selectedIndex].Cells[]Text;'is used to get dataGridView`s data which is in form1.
But I don`t know how to wirte and where to write the code.
Posted
Updated 10-Sep-19 19:56pm
v2
Comments
BillWoodruff 11-Sep-19 7:30am
   
What event in what Form will trigger the copying/pasting ?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Exactly how depends on the "relationship" between the two forms.
Have a look at these, one of them will fit your circumstances.
The form that creates an instance of another:
MyForm mf = new MyForm();
mf.Show();
Is the "parent", the other form is the "child".
(This doesn't imply any formal MDI relationship)

Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100