drop-down list box added to the collection

= objClassService.GetClassList cboClassName.DataSource ();
cboClassName.DisplayMember = "ClassName"; // set the drop-down box text displayed
cboClassName.ValueMember = "ClassId"; // set the drop-down box text corresponding to Value

cboClassName.SelectedIndex = -1;

Note: The drop-down box DropDownStyles property to DropDownList, change can not be edited, the default is editable

Guess you like

Origin www.cnblogs.com/GY66520/p/12129340.html