hello guys , i have created a form with 3 radio buttons in a groupbox.
and 4 check boxes also in a groupbox . in my form i have a button and a text box which is set not to be visible before the button is clicked. now i want to make the selected item from the radio button group and whichever check box is selected from the checkbox group to be displayed in the textbox as soon as the button is clicked. any help please?
Loading
VulpesPosted Sep 25, 2011, 1:50 PM
azzo stonesPosted Sep 26, 2011, 9:25 AM
azzo stonesPosted Sep 26, 2011, 8:44 AM
Sam HobbsPosted Sep 25, 2011, 2:10 PM
Note that you are using the RadioButton.Checked Property to check if the radio button is checked. You can use the Text Property of the radio button to get the text for each of them. The same for check boxes. Then you can get the text that was entered into the designer.
Does that help? Is there more you want to do?
azzo stonesPosted Sep 25, 2011, 1:10 PM
textBox1.Visible = true;
if (Rbred.Checked)
{
textBox1.Text = " Your favourite colour is Red";
}
else if (Rbblue.Checked)
{
textBox1.Text = " Your favourite colour is Blue";
}
else if (Rbgrey.Checked)
{
textBox1.Text = " Your favourite colour is Grey";
}
if (slpcb.Checked)
{
textBox1.Text += ", and your favourite hobby is / are Sleeping";
}
if (Rdcb.Checked)
{
textBox1.Text += ",reading ";
}
if (Fshcb.Checked)
{
textBox1.Text += ",fishing";
}
if (Dccb.Checked)
textBox1.Text += ",dancing";
i just wanted to make it more simple for example that "Your favourite colour is"
would be written one time in the code and the "your favourite hobby is /are would change from singular to plural if one or more hobbies are selected
thanks poeple.your great.
Sam HobbsPosted Sep 24, 2011, 5:13 PM
I am not sure what you are asking. I do not understand "make the selected item from the radio button group and whichever check box is selected from the checkbox group to be displayed in the textbox". I am not really sure what you need to show in the textbox. Normally, checkboxes are either selected or not (yes or no) and the same for radio buttons but for radio buttons we can specify the number of which one is selected. Perhaps what your teacher did is to get the text associated with each box or button. So try to look up or remember how it is possible to determine what is selected. You should learn how to look up stuff like that. Also look up how to get the text of a control. You need to know how to use the documentation. If you find the documentation and need help understanding it then let us know what youi need help with, but please try.
Prabhu RajaPosted Sep 24, 2011, 1:02 AM
azzo stonesPosted Sep 23, 2011, 10:15 AM
Prabhu RajaPosted Sep 23, 2011, 12:36 AM
I attached Source Code Here. Hopw It will be useful.
-------------------------------------------------------------
If this post helps you, then mark as "Correct Answer"
Thank You