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:
and expect it to work. What code could I use to effectively do the same thing?Code:string rowNumber = "R1_" string temp1 = "fred.Text"; string temp2 = temp1.Insert (0, rowNumber); risk = int.Parse(temp2);
Please be gentle, I am somewhat new to C#.
Thanks!
p.s. using .net 4.


Reply With Quote
Bookmarks