Is there a way when a user selects a choice from a radio button from a group-box to appear in a label?
It would be on the line with Quantity/Phone Type right after numberPhoneTextBox.Text.
There are a total of 3 radio-buttons for the user to choose from.
private void displayButton_Click(object sender, EventArgs e)
{
summaryLabel.Text = "Receipt Summary\n" +
"--------------\n" +
"Name: " + nameTextBox.Text +
"\nAddress: " + streetTextBox.Text +
"\nCity: " + cityTextBox.Text +
"\nState: " + stateTextBox.Text +
"\nZip Code: " + zipTextBox.Text +
"\nPhone Number: " + phoneNumberTextBox.Text +
"\nDate: " + dateMaskedBox.Text +
"\n-------------------------" +
"\nQuantity/Phone Type: " + numberPhoneTextBox.Text + "/";
}
You would have to do it by hand, unfortunately. You could define a method or property that performs the task for you to avoid repetitive code, like so:
UPDATE:
Apparently the OP’s assignment “doesn’t allow the user of if/else statements” – that’s quite surreal, but you can skirt it several ways, such as using the
?:operator:Another option is to use events: