B
Brad McMillan
Hi:
I have MS C# 2005 Express Edition and I'm trying to pass a string to a
new form in my project.
First I created the form, Customer, with a textbox, "textBox1", and
declared a string "name":
namespace myProject
{
public partial class Customer : Form
{
public string name;
public Customer()
{
InitializeComponent();
textBox1.Text = name;
}
}
}
Then, in my main program I have a buttom click event that activates
the form:
private void button1_Click(object sender, EventArgs e)
{
Customer dlg1 = new Customer();
dlg1.name = "test";
dlg1.ShowDialog();
}
But, when I press button1 the string "test" does not show up in
textBox1.
Can anyone tell me what I need to do to get the string to pass to my
new form?
TIA,
Brad McMillan
I have MS C# 2005 Express Edition and I'm trying to pass a string to a
new form in my project.
First I created the form, Customer, with a textbox, "textBox1", and
declared a string "name":
namespace myProject
{
public partial class Customer : Form
{
public string name;
public Customer()
{
InitializeComponent();
textBox1.Text = name;
}
}
}
Then, in my main program I have a buttom click event that activates
the form:
private void button1_Click(object sender, EventArgs e)
{
Customer dlg1 = new Customer();
dlg1.name = "test";
dlg1.ShowDialog();
}
But, when I press button1 the string "test" does not show up in
textBox1.
Can anyone tell me what I need to do to get the string to pass to my
new form?
TIA,
Brad McMillan