When I set comboBoxEdit.selectedindex = some value, it never take this value. its value is always -1. I have set it in Constructor or in Form_Load.
if (oPersclientEntrp.TypPrint == 1) {
comboBoxEdit_Print.SelectedIndex = 0;
} else {
comboBoxEdit_Print.SelectedIndex = 2;
}
I have heard that The SelectedValue, SelectedIndex, SelectedItem properties can't be set until the control is added to the form. After the control is added to the form, the selectedValue, -Index and -Item properties can be set.
but I bind the value on design mode .
Try updating your code to be this:
if (oPersclientEntrp.TypPrint == 1) { comboBoxEdit_Print.SelectedIndex = 0; }
else { comboBoxEdit_Print.SelectedIndex = 1; }
If you only have 2 items, your SelectIndex
should be 1, not 2.