Radio button help please

desperado

Well-known member
Joined
Oct 7, 2006
Messages
68
Programming Experience
Beginner
Hey people

I was hoping somebody out there could offer me a little help on my program please. On my form I have 8 radio buttons and 3 text boxes.

The way my program works is the first 4 radio buttons have 4 numbers next to them, -1, -2, +1 and +2, the other four radio buttons have comments like poor, satisfactory, great and excellent. The first text box has a numeric value you in there and the other two text boxes are empty.

What I’m after is some help so if a radio button is selected (from the first four) the amount in text box 1 gets changed, and the text from the same radio button is shown in text box 2, also the comment chosen from the last 4 radio button should get shown in text box3.

For example if the +2 radio button is selected with the ‘great’ radio button and the text box 1 had the original value of 20 I want 22 to be shown in text box1 and ‘+2’ and ‘great’ in textbox 2 and text box 3..

Any help or suggestions please?

So far I have the following

VB.NET:
txtmerit.Text = Convert.ToString(Convert.ToInt32(txtmerit.Text) - 1)

However it doesn't work well. I can see another problem im facing now and that is whenever a user selects -1 for example and then +1 the total at the end should be +1 to the amount in text box 1 not the original amount.
 
You need to handle the CheckedChanged event of each RadioButton. To create a handler just double-click the control in the designer.

You need to test the RadionButton's Checked property, because the event will be raised when it's checked AND when it's unchecked. If it's checked then you do what you need to do, like set the Text of a TextBox.

Also, this question relates to Windows Forms specifically so I've moved it. Please post in the most suitable form for the question in future.
 
Back
Top