ComboBox Event
-
Hello, I have a combobox, which is a DropDownList (can't type inside the box) with values: a, b, and c for example. Is there an event, that will be triggered only when the text changed, if value of combobox was a and new value is b, fire event. However, if value was a and user picks a again, don't fire event. Thank you.
-
Hello, I have a combobox, which is a DropDownList (can't type inside the box) with values: a, b, and c for example. Is there an event, that will be triggered only when the text changed, if value of combobox was a and new value is b, fire event. However, if value was a and user picks a again, don't fire event. Thank you.
DropDown event Occurs when the drop-down portion of a ComboBox is shown. we can use the event when the text changed in the combobox. This event is raised if the Text property is changed by either a programmatic modification or user interaction. private void currencyTextBox_TextChanged(object sender, EventArgs e) { try { // Convert the text to a Double and determine if it is a negative number. if(double.Parse(currencyTextBox.Text) < 0) { // If the number is negative, display it in Red. currencyTextBox.ForeColor = Color.Red; } else { // If the number is not negative, display it in Black. currencyTextBox.ForeColor = Color.Black; } } catch { // If there is an error, display the text using the system colors. currencyTextBox.ForeColor = SystemColors.ControlText; } } mahes