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:

risk = int.Parse(R1_fred.Text);

However, I'd like to replace "R1_" with "R2_" or "R3_". Unfortunately, I cannot do the following:

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#.


p.s. using .net 4.