I have the following code in vs2005; line number is added for convenience:
1 private void Form1_Load(object sender, EventArgs e)
2 {
3 txtMyField.Enabled = true;
4 Form2 f = new Form2();
5 f.DoUpdate += new Form2.UpdateHandler(MyForm2_ButtonClicked);
6 }
7 private void MyForm2_ButtonClicked(object sender, ValuesUpdateEventArgs3 e)
8 {
9 string sValues = "";
10 sValues = e.Val1;
11 txtMyField.Text = sValues;
12 }
Currently, my field name txtMyField.text is hardcoded and gets a value from
sValues (line #10).
Instead of hardcoding a fieldname as in Line #10; how do I pass the control
name on line #5 to event in Line #7?
Something like:
5 f.DoUpdate += new
Form2.UpdateHandler(MyForm2_ButtonClicked(txtMyFie ld.Text));
Thanks in advance.