winform 里只有combobox没有dropdownlist吗?
它们有什么区别?
setCmbInitial();//加载combobox数据
int filetype=2;
 if (strPlayListSubId != string.Empty)
            {
                //显示明细
                DataRow[] drTemp = dtPlayListSub.Select("I_ID='" + strPlayListSubId + "'");
                if (drTemp.Length > 0)
                {
                    DataRow dr = drTemp[0];
                    txtIndex.Text = dr["I_Index"].ToString();
                    if (cmbSource.Items.Count < 2)
                        cmbSource.SelectedIndex = 0;
                    else
                        cmbSource.SelectedIndex = int.Parse(dr["I_From"].ToString());
                    txtFileName.Text = dr["I_FileSource"].ToString();
                    txtAlias.Text = dr["I_Alias"].ToString();                    cmbSource.SelectedIndex = filetype; //为什么这里设置cmbSource的下拉项没有反应?

解决方案 »

  1.   

    ComboBox有一个DropDownStyle属性,可以设置不同风格。
      

  2.   

    1.可能是列表中不足两项;
    2.窗口没有及时刷新,用Application.DoEvents()试试。
      

  3.   

    cmbSource.SelectedIndex = filetype; //为什么这里设置cmbSource的下拉项没有反应?
    -----------------------------------
    这是更改当前选中的项。不明白你这是在做什么,前面代码中已经设置过了。