Click here to Skip to main content
15,884,739 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a textbox in form 1, and i have a checkbox in form 2, i wont to get checkBox checked value from the form number 2 into the textbox in form 1 whene you're click in the button in form 2 the valo in checkbox go to the textbox in form 1.
and tnx.

What I have tried:

can you help me pliiz

private void button1_Click(object sender, EventArgs e)
{


}
Posted
Updated 21-Aug-20 22:35pm
Comments
F-ES Sitecore 21-Aug-20 12:53pm    
Have properties that expose the things you want to read, so form2 will have a bool property called "CheckBox" (or whatever) that returns true if it is checked otherwise false. Similarly you could have an "UpdateTextbox" method on form1 that sets the value of the checkbox. You then just need to call the relevant properties\methods on the various forms to do what you want to do. The kicker is that form2 will need a reference to form1 and how possible\viable that is depends on how you're creating these forms. You might need to use events to communicate button clicks to your main GUI form if form1 and form2 are both sub-forms.
Member 14919875 22-Aug-20 6:21am    
tnx u, Bro ,i know that but what i wonna do ,i wont to click in a button in form 1, that button show you the other form , that form (fomr 2) , have a checkbox between 12 checkbox, when you chose the value checkbox ,and cleck in a button in form 2 (form 2 chekchbox) when you cleck in it he close and show the value in textbox in form 1, and tnx you again and i'm sorry if i don't explain to you very well
F-ES Sitecore 22-Aug-20 7:52am    
So start writing the code :) We don't mind helping where you are stuck but we're not going to write all of the code for you.
Member 14919875 22-Aug-20 14:23pm    
i try a lot of my code but its not working but thanks u again anyway

1 solution

You can do it via various ways:
1. Constructor
2. Properties
3. Object
4. Delegates

Depending on the need/usecase/workflow, you would use one of them. For simple case, most of the times I have seen we tend to use Properties approach.

Following reference should guide you: Passing Data Between Forms[^]
 
Share this answer
 
v2
Comments
Member 14919875 22-Aug-20 4:36am    
tnx u, Bro ,i know that but what i wonna do ,i wont to click in a button in form 1, that button show you the other form , that form (fomr 2) , have a checkbox between 12 checkbox, when you chose the value checkbox ,and cleck in a button in form 2 (form 2 chekchbox) when you cleck in it he close and show the value in textbox in form 1, and tnx you again and i'm sorry if i don't explain to you very well

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900