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.
Loading
Mahesh ChandPosted Jun 25, 2008, 7:05 AM
Create a public property say "ChangeTextBoxText" of string type and within this property on Set modifier, put your TextBox1.Text = Value; and from your external class, set this property.