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.
couponType
outside. – Priyank Patel Jan 29 '13 at 11:47