Changing Text property of textbox from another class

Jun 25 2008 6:09 AM
Hi
I want to change my text in the textbox on a form but the text property of textbox control is not changing the text in another class. I don't want to return anything from the class1's method(textChanged();)
// This is Form Code
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public void button1_Click(object sender, EventArgs e)
{
Class1 cs = new Class1();
cs.textChanged();
}
}


//This is class code
public class Class1
{

public void textChanged()
{
Form1 frm1 =new Form1();
frm1.textBox1.Text = "HELLO FARAZ";
}
}
please solve my problem thanks in advance.

Answers (1)