Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9211825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:23:06+00:00 2026-06-18T01:23:06+00:00

I am relatively new to C# and I am trying to create an app

  • 0

I am relatively new to C# and I am trying to create an app where a user can supply a lot of data about bonds. So I have a lot of textboxes for bonds names etc and I have 2 radio buttons inside a groupbox to define a coupon type. So, I have a radio button for Fixed and for Zero. What I want to happen is that when a user selects one of the radio buttons, that the selection will be added to a list.

I was trying to do a boolean and say:

if (rdbtn_Fixed.Checked)
{
    string couponType = rdbtn_Fixed.Text;
}
else
{
    if (rdbtn_Zero.Checked)
    {
        string couponType = rdbtn_Zero.Text;
    }
}

Though I know it was a long shot because I didn’t think you can define a variable that way. I have a method calling a different class as such:

Bond bonds = CreateBond(cusip, ticker, name, maturityNoTime, coupon, primaryBook, assignedBook, couponType, positionValue);

So I am having trouble defining the couponType as whichever radio button is selected.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:23:08+00:00Added an answer on June 18, 2026 at 1:23 am

    You simply need to put the declaration of couponType outside the if:

    string couponType = null;
    
    if (rdbtn_Fixed.Checked)
        couponType = rdbtn_Fixed.Text;
    else if (rdbtn_Zero.Checked)
        couponType = rdbtn_Zero.Text;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to app development and I am trying to create a relatively
I'm relatively new to utilizing web services. I'm trying to create one that will
I am a relatively new user of Visual Studio and I am trying program
I have an ASP.NET MVC 4 app. I'm relatively new to ASP.NET MVC 4.
I'm relatively new to jQuery and I'm trying to create a custom jQuery function.
Hi I am relatively new to javascript and jQuery and while trying to create
I'm relatively new to PHP and have exhausted the internet trying to find an
I have been trying to create a simple application that will let the user
I am relatively new to flash. I am trying to create a square grid
i am relatively new to Android programming. i have gone through a lot of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.