O
O.B.
I have a System.Windows.Forms.ComboBox (called bandwidthComboBox) in
my application with the following dropdown items:
T1 (1.544 Mbps)
T2 (6.312 Mbps)
T3 (44.736 Mbps)
When the user selects an item from the list, I want the text box to
only display the numerical value. I have added a callback for
SelectedIndexChanged, SelectedValueChanged, and
SelectionChangeCommitted as follows but the ComboBox is still showing
the selected value rather than just the number. Help?
private void OnSelectBandwidth(object sender, EventArgs e)
{
double value = 0.0;
switch(bandwidthComboBox.SelectedItem.ToString())
{
case "T1 (1.544 Mbps)":
value = 1.544;
break;
case "T2 (6.312 Mbps)":
value = 6.312;
break;
case "T3 (44.736 Mbps)":
value = 44.736;
break;
}
bandwidthComboBox.Text = value.ToString();
}
my application with the following dropdown items:
T1 (1.544 Mbps)
T2 (6.312 Mbps)
T3 (44.736 Mbps)
When the user selects an item from the list, I want the text box to
only display the numerical value. I have added a callback for
SelectedIndexChanged, SelectedValueChanged, and
SelectionChangeCommitted as follows but the ComboBox is still showing
the selected value rather than just the number. Help?
private void OnSelectBandwidth(object sender, EventArgs e)
{
double value = 0.0;
switch(bandwidthComboBox.SelectedItem.ToString())
{
case "T1 (1.544 Mbps)":
value = 1.544;
break;
case "T2 (6.312 Mbps)":
value = 6.312;
break;
case "T3 (44.736 Mbps)":
value = 44.736;
break;
}
bandwidthComboBox.Text = value.ToString();
}