How can my program read a numerical value from the keyborad entered in a text box, assing it to a variable, and then display output in onther text box?
Keyboard input in Visual C# windows applications form?
{
string strnumber = "";
TextBox2.Text = "";
foreach (char cha in TextBox1.Text) {
if (char.IsNumber(cha)) {
strnumber = strnumber + cha;
}
}
int intnumber = strnumber;
TextBox2.Text = intnumber;
}
You could just add each character to the textbox, so instead of:
strnumber = strnumber + cha;
you could do
textbox2.text = textbox2.text + cha;
but you said you wanted to store the number as an variable.
I think thats what you wanted, else, ask again and ill try to help.
So like... da21s3as12asasdas would become 21312
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment