Click here to Skip to main content
15,887,421 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guys..im new to asp.net. im trying to show a double value in textbox based on radio button but it is not showing it. Here is the code im using
double res = 0;
double num1 = Convert.ToDouble(txt1.Text);
double num2 = Convert.ToDouble(txt2.Text);

if (radioAdd.Checked )
    res = num1 + num2;
else if (radioSub.Checked == true)
    res = num1 - num2;
else if (radioMul.Checked == true)
    res = num1 * num2;
else
    res = num1 / num2;

txtResult.Text += res.ToString();
Posted

When are you trying to show the value? Looks like you are missing an event.

Steps:
1. UI has radio button and 2 textbox for input and one for result and one button for show result
2. Select radibutton, put values in two textboxes and click show result button.
3. On button click event, put the above code and you can see the computed result in result textbox.
 
Share this answer
 
Comments
AmbiguousName 3-Oct-10 10:02am    
Nothing happened. I put a break point on the routine I wrote but nothing happened
Sandeep Mewara 3-Oct-10 10:02am    
What do you mean by nothing happened? It never hit the breakpoint?
AmbiguousName 3-Oct-10 10:08am    
yes. it did't hit the break point.
Hi,

try this

txtResult.Text = string.Format("{0:d}",res);

Hope this will help
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900