我用了一个Visual Studio 2005(Winform)ComboBox控件,
它是只可以选择,也可以自己输入
现在,怎么去这两种情况的值
请教各位

解决方案 »

  1.   

    comboBox.SelectedValue根本不对呀
      

  2.   

    int selectedIndex = comboBox1.SelectedIndex;
        Object selectedItem = comboBox1.SelectedItem;    MessageBox.Show("Selected Item Text: " + selectedItem.ToString() + "\n" +
                        "Index: " + selectedIndex.ToString());
      

  3.   

    好像还有个SelectedText,都可以取得文本值...
      

  4.   

    Object selectedItem = comboBox1.SelectedItem;
    不能取到输入的文本的值,它得到的下拉框选中的值
      

  5.   

    this.comboBox1.SelectedValue.ToString();
                this.comboBox1.SelectedText
    这种写法前提是你的ComBox因该是关联DataSet  
    例如 
                this.comboBox1.DataSource =
                this.comboBox1.DisplayMember= 
                this.comboBox1.ValueMember =
      

  6.   

    string str ="";
    str=comboBox.Text.ToString();