I have a TextBox named textbox_input which calls the following function when focus is lost:
Code:
private void textbox_input_Leave(object sender, EventArgs e) {
textbox_debug.Text += "GetType: " + sender.GetType().ToString();
textbox_debug.Text += "ToString: " + sender.ToString();
//MyOtherObject.testFormControl (sender);
}
Typing "Hello" into the TextBox and leaving prints out:
Quote:
GetType: System.Windows.Forms.TextBox
ToString: System.Windows.Forms.TextBox, Text: Hello
|
Now what I would to do is call the (commented out) testFormControl method located in MyOtherObject. This method has the following prototype:
Code:
public void testFormControl (System.Windows.Forms.TextBox to_test)
However when I uncomment the line above I get the error:
Quote:
|
Argument 1: cannot convert from 'object' to 'System.Windows.Forms.TextBox'
|
So it seems to me that I have this generic 'object' type that references the actual TextBox object, how do I de-reference, if you will, so that my testFormControl() method can receive the actual TextBox object?