小问题,
combobox如何在设计界面时,就默认选择某一项?以及如何用代码选择某一项?
不知道有什么属性,乱看了好久都没看见。。

解决方案 »

  1.   

    selectedindex=0;//选中第一项。。
      

  2.   

    this.combobox1.selectedindex=索引(0-第一项,1-第二项 ......)
      

  3.   


    comboBox4.SelectedIndex = 0;

    comboBox4.SelectedIndex = comboBox4.Items.IndexOf("字符串");
      

  4.   

       this.comboBox1.Items.Add("A");
                this.comboBox1.Items.Add("B");
                this.comboBox1.Items.Add("C");
                this.comboBox1.SelectedIndex = 2;
    默认就是C了,楼上解答了!
      

  5.   

    设计时,没有 SelectedIndex属性啊,,我用VS2008
      

  6.   

    this.comboBox1.SelectedIndex = 2;楼上正解
      

  7.   

    你在 initializeComponent后写上
    this.comboBox1.SelectedIndex = 你想指定的索引 
      

  8.   

    08没有? 我的是05
    那你的comboBox有啥select的属性啊?
    你直接写代码里,别在设计里整public partial class Form2 : Form
        {
            public Form2()
            {
                InitializeComponent();
                this.comboBox1.Items.Add("A");
                this.comboBox1.Items.Add("B");
                this.comboBox1.Items.Add("C");
                this.comboBox1.SelectedText = "C";
            }
    }
      

  9.   

    comboBox1.SelectedIndex = 0;
      

  10.   

    知道了,谢谢。。感觉 他比delphi还差点啊
      

  11.   

    要么你自己派生一个combobox,然后提供一个可以在属性浏览器里设置的selectedIndex属性
      

  12.   

    设计里不可能没有selectedindex属性,你没看到吧