ComboBox中设置默认值

来源:互联网 发布:线程 java 编辑:程序博客网 时间:2024/05/20 18:47

可以在窗体载入事件中(  private void XXX_Load(object sender, EventArgs e)),设置ComboBox的SelectedIndex属性为相关的索引值。

如:

private void XXX_Load(object sender, EventArgs e)        {            this.cmb_ComPorts.SelectedIndex = 0;            this.cmb_BaudRate.SelectedIndex = 6;            this.cmb_DataBits.SelectedIndex = 0;            this.cmb_StopBits.SelectedIndex = 0;            this.cmb_Parity.SelectedIndex = 0;        }