private void hpGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            
//判断要处理的DataGridViewComboBoxColumn名称,若符合条件,编辑控件被强制转换为ComboBox以处理,添加SelectedIndexChanged事件
            if (this.hpGridView1.CurrentCell.OwningColumn.Name == "clmTest")
            {
                ((ComboBox)e.Control).SelectedIndexChanged 
+= new EventHandler(ComboBox_SelectedIndexChanged);
            }

        }

        
/// <summary>
        
/// SelectedIndexChanged事件触发时需要进行的处理
        
/// </summary>
        
/// <param name="sender"></param>
        
/// <param name="e"></param>
        private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            
this.hpGridView1.CurrentRow.Cells["name"].Value = ((ComboBox)sender).Text;
        }

相关文章:

  • 2021-12-23
  • 2022-12-23
  • 2021-08-20
  • 2021-11-03
  • 2022-12-23
  • 2023-03-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-03-05
  • 2021-07-12
  • 2021-10-22
相关资源
相似解决方案