M
MounilK
Hi all,
I have a form which has a TabControl and a Button. At runtime, on the
TabControl, I create a TabPage with a TextBoxes. Now, when I click the
button after entering some text in the textbox, I want to show the text in a
messagebox. I tried the following code but get an error.
foreach (System.Windows.Forms.TextBox myTextBox in myTabPage.Controls)
{
MessageBox.Show (myTextBox.Text);
}
The error I get is:-
"An unhandled exception of type 'System.InvalidCastException' occurred in
MyLib.dll
Additional information: Specified cast is not valid."
How do I get this right?
TIA,
Mounil.
I have a form which has a TabControl and a Button. At runtime, on the
TabControl, I create a TabPage with a TextBoxes. Now, when I click the
button after entering some text in the textbox, I want to show the text in a
messagebox. I tried the following code but get an error.
foreach (System.Windows.Forms.TextBox myTextBox in myTabPage.Controls)
{
MessageBox.Show (myTextBox.Text);
}
The error I get is:-
"An unhandled exception of type 'System.InvalidCastException' occurred in
MyLib.dll
Additional information: Specified cast is not valid."
How do I get this right?
TIA,
Mounil.