Three radio buttons and a text box, grouped in one group box... Just when I select one of those radio button the text box gets enabled, for the other two radio buttons it should be disabled. Here is the code that comes to mind at first, but it looks ugly to me becuase I have copy pasted the same AllowMissingData() method to Change evnt of each radio button. I was wondering if there is a better way of writing it:
private void RequiredRadioButton_CheckedChanged(object sender, EventArgs e)
{
AllowMissingData();
}
private void AllowBlankRadioButton_CheckedChanged(object sender, EventArgs e)
{
AllowMissingData();
}
private void SuppressRadioButton_CheckedChanged(object sender, EventArgs e)
{
AllowMissingData();
}
private void AllowMissingData()
{
if (AllowBlankRadioButton.Checked)
{
MissingDataValueTextBox.Enabled = true;
}
else
{
MissingDataValueTextBox.Text = System.String.Empty;
MissingDataValueTextBox.Enabled = false;
}
}