Hello:
I am writing my own validation routine and I need to get some information from the TextBox that I am coming from.
I am using: ((TextBox)sender).Name.ToString() To get the name of the TextBox.
Is there a way to get the Text Value of the TextBox? I know if I do a: ((TextBox)sender) It will give me: "System.Windows.Forms.textBox, Text: Company" The Value that I want is the "Company". I guess it I can parse it and get it, but is there a simpler way like the: ((TextBox)sender).Name.ToString() ?
Loading
Dipa AhujaPosted May 5, 2010, 11:59 AM
GustavoPosted May 5, 2010, 12:32 PM
After looking at your sample... I figured it out. Thanks.
To get the name of the TextBox I did a: TheField_ID = ((TextBox)sender).Name.ToString().Substring(7);
To get the value in the TextBox I did a: TheValue = ((TextBox)sender).Text;
Thanks
GustavoPosted May 5, 2010, 12:04 PM
I created a control class that will do the testing and it works for many type of variables. But I have to send it the value of the textBox.