[RESOLVED] C# filling textbox based on several radiobuttos (If--Else)-VBForums
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
    144

    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 03:29 AM.

  2. #2
    Fanatic Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    575

    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
    144

    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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.