现在的位置: 首页 > 综合 > 正文

ComboBox中设置默认值

2013年11月07日 ⁄ 综合 ⁄ 共 308字 ⁄ 字号 评论关闭

可以在窗体载入事件中(  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;
        }

抱歉!评论已关闭.