Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just know set checkListBox modifier = internal.
and
C#
Form1 fm1 = new Form1();
fm1.checkListBox1.Text = this.checkBox1.Text

it 's does't work.
Can anyone suggest me an idea about that.
See the following image.
http://terzasek.zhotspot.com/image/10152389_778170718888436_3719562139504542058_n.jpg[^]
Posted
Comments
[no name] 25-Oct-14 11:24am    
Did you go read the documentation for the CheckedListBox to find out how to use it first?
terzasek 27-Oct-14 22:01pm    
Sorry. I just want to use.
I did read before.
BillWoodruff 25-Oct-14 16:02pm    
Is Form1 the main form, and does it create the instance of Form2 ? What do the buttons on the two Forms do ? Do you want to update the CheckedListBox on Form1 every time a CheckBox on Form2 is checked, or unchecked, or update when the button on Form2 is clicked.

Remember we can't read your mind.
terzasek 27-Oct-14 22:10pm    
Is Form1 the main form, When checked any checkBox in Form2 and click Transfer button the data will transfer to Form1.

No, it won't.
That's partly because when you do this:
C#
Form1 fm1 = new Form1();
It creates a new instance of teh form, not accesses the instance that is displaying.
It's a bit like cars: if you put your mobile phone in the glove box of your car, then buy a new one - would you expect to find your mobile in the new car glove box?

You need to access the existing instance of Form1, not create a new one.
But...the better way is to get the existing instance to do it for you...

Depending on the relationship between the forms, have a look at these:
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[^]

Judging from the names, you probably want part 2.
 
Share this answer
 
The easiest way I can think of is the following:

Call Form2 as a dialog(with ShowDialog())and make a public variable in your Form2 which will hold the data you want to transfer between forms(which in your case is a bool[]) then use that variable back in Form1 however you want.
 
Share this answer
 
v2

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