Question

I have a combobox1 on form1, but i wanna access it on form2 (able to full edit) is it possible by turning it public and using

form1.comboBox1_ChangedItem(blablabla)
{
// stuff
 }

?

Edit: there was a answer here, i was trying to implement it but it got deleted.. what happened?

Was it helpful?

Solution

Making a combobox public does violates the rules of object-oriented. Better way is use a property to do this.

 Public ComboBox1
 {
      get { return this.comboBox1;  }
      set { comboBox1 = value; }
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top