-
January 18th, 2013, 04:33 PM
#1
how to parse a text box to an integer - but....
If you have a form, with multiple text boxes. R1_fred, R2_fred, R3_fred -- and would like to parse what is in that text box into an integer, you could use:
Code:
risk = int.Parse(R1_fred.Text);
However, I'd like to replace "R1_" with "R2_" or "R3_". Unfortunately, I cannot do the following:
Code:
string rowNumber = "R1_"
string temp1 = "fred.Text";
string temp2 = temp1.Insert (0, rowNumber);
risk = int.Parse(temp2);
and expect it to work. What code could I use to effectively do the same thing?
Please be gentle, I am somewhat new to C#.
Thanks!
p.s. using .net 4.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|