I have this code
private void FrmNovedadMedidas_SelectionChangeCommitted(object sender, EventArgs e)
{
ComboBox c = (ComboBox)sender;
CargarMedidasPorIdTipoMedida(Convert.ToInt16(c.SelectedValue));
this.txtBoxNombreTipoMedida.Text = c.SelectedText;
}
in c.SelectedValue got the new value of the selection (the one that the user has selected in the Combo).
But in c.SelectedText I got the old value of the ComboBox (I mean, the one that was before the user change the selection).
Is there any property that can give me the new Selected Text?
I want to avoid to search in the DataSet binded to the ComboBox everytime.
I’ve read this but doesn’t work, I don’t have CommitEdit() in ComboBox
edit:
c.Text also gives me the old one
I seem to remember this situation having to do with the
DropDownStyleof the ComboBox.Can you please try different styles and see if the Text property is set to the new value inside
SelectionChangeCommited?As per your comment, it seems using
DropDownListstyle solves the issue.Cheers