M
Mike Thompson
I have an event handler defined within a class. It has the following
signature:
static void XYZ_EventHandler (object sender, XYZEventArgs e)
From within this event handler, I want to access the contents of a textbox
on the form that is defined within the default Form1 class. Ordinarily, I
would pass the form to any class member function as an argument, but because
this is an event handler, I can't pass it.
I tried to create a new instance of Form1 within the event handler (Form1
frm = new Form1()), then access frm.textBox1.Text, but it's a new instance
of Form1 and doesn't return the contents of any change set in the text box
on the first instance of Form1.
So my question is, how can I access the contents of a textbox on the default
Form1 in an event handler defined in a class that is not part of the default
Form1 class?
The language is C#. Any help would be most appreciated. Thanks.
signature:
static void XYZ_EventHandler (object sender, XYZEventArgs e)
From within this event handler, I want to access the contents of a textbox
on the form that is defined within the default Form1 class. Ordinarily, I
would pass the form to any class member function as an argument, but because
this is an event handler, I can't pass it.
I tried to create a new instance of Form1 within the event handler (Form1
frm = new Form1()), then access frm.textBox1.Text, but it's a new instance
of Form1 and doesn't return the contents of any change set in the text box
on the first instance of Form1.
So my question is, how can I access the contents of a textbox on the default
Form1 in an event handler defined in a class that is not part of the default
Form1 class?
The language is C#. Any help would be most appreciated. Thanks.