Results 1 to 3 of 3

Thread: [RESOLVED] C# filling textbox based on several radiobuttos (If--Else)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2003
    Location
    netherlands
    Posts
    163

    Resolved [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.

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2003
    Location
    netherlands
    Posts
    163

    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
  •  



Click Here to Expand Forum to Full Width