-
Jun 2nd, 2017, 01:49 AM
#1
Thread Starter
Addicted Member
[RESOLVED] C# filling textbox based on several radiobuttos (If--Else)
I am new to C#, but have some experience with VB.
I have a problem that is not too complex in VB, but i have no idea on how to do this in C#.
Code:
public string radiobuttonchecked()
{
if (radioButtonPV.Checked == true) and (radioButtonFG.Checked == true) and (radioButtonFP.Checked == true)
{
return "TableAA";
}
else
if (radioButtonASS.Checked == true) and (radioButtonFG.Checked == true) and (radioButtonFP.Checked == true)
{
return "TableBB";
}
else
Also tried to replace "and" by && with no result.
I know how to call the returned value in a textbox, but it is unclear on how to get to this point.
Last edited by rakker; Jun 2nd, 2017 at 02:29 AM.
-
Jun 2nd, 2017, 02:40 AM
#2
Re: C# filling textbox based on several radiobuttos (If--Else)
Try something like
Code:
public string radiobuttonchecked()
{
if (radioButtonPV.Checked == true && radioButtonFG.Checked == true && radioButtonFP.Checked == true)
{
return "TableAA";
}
else
if (radioButtonASS.Checked == true && radioButtonFG.Checked == true && radioButtonFP.Checked == true)
{
return "TableBB";
}
else
In C# the enter check for the if statement needs to be inside the () characters.
-
Jun 2nd, 2017, 08:19 AM
#3
Thread Starter
Addicted Member
Re: [RESOLVED] C# filling textbox based on several radiobuttos (If--Else)
Thank you. This solved my problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|