如题,我给combox列绑定了数据源,但是要怎么才能获取到用户在该列上选择的value 以实现保存功能。谢谢!

解决方案 »

  1.   

    直接获取Combox控件的Text属性不就可以了?
    string strValue = combox.Text;
      

  2.   

    string selectValue =(string)(this.dataGridView1.Rows[e.RowIndex].Cells[1] as DataGridViewComboBoxCell).Value; 
    private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
      {
      this.dataGridView1.CurrentRow.Cells["name"].Value = ((ComboBox)sender).Text;
      }
      

  3.   

    string strValue = combox.Text;
      

  4.   


    请问DataGridView中这个combox 列有SelectedIndexChanged 事件吗?怎么才能找到?再一个,您private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
      {
      this.dataGridView1.CurrentRow.Cells["name"].Value = ((ComboBox)sender).Text;
      }是给那个combox 列赋值吗? 我这个combox列有自己的数据源,是名字叫'name'的combox列吗?thx
      

  5.   


    Combox列没有这个Text熟悉。我这个列有自己的数据源,是Value与Txt那种的,表现上是Text,但背后选取的是其value,烦请大虾赐教 thx
      

  6.   


              ComboBox cm = new ComboBox();
              string txt = cm.SelectedText;       //你选择的Text值
                string value = cm.SelectedValue;    //你选择的Value值
      

  7.   

    gridview 有个事件,叫EndEdit()