You need to pass a reference to Form1 to your class when creating it.
public class Form1 : System.Windows.Forms.Form
{
private Class1;
public ComboBox ComboBox1;
public string ComboText
{
get
{
return ComboBox1.Text;
}
set
{
if(value.Length <= 15)
ComboBox1.Text = value;
}
}
public Form1()
{
Class1 = new Class1(this);
}
public void ChangeValues()
{
ComboBox1.Text = "Text Sample 2";
}
}
public class Class1
{
private Parent;
public Class1(Form1 f)
{
Parent = f;
}
private void SomeMethod()
{
Parent.ComboBox1.Text = "Text Sample 1";
Parent.ChangeValues();
Parent.ComboText = "Text Sample 3";
}
}
Happy coding!
Morten
--
Using M2, Opera's revolutionary e-mail client:
http://www.opera.com/m2/