private void cmb_Temp_SelectedIndexChanged(object sender, EventArgs e)
{
int Rowx = dataGridView1.CurrentCell.RowIndex;
if (((ComboBox)sender).Text == "买入")
{
dataGridView1.Rows[Rowx].DefaultCellStyle.ForeColor = Color.Blue; dataGridView1.CurrentCell.Value = "买入";
dataGridView1.CurrentCell.Tag = "买入";
}
else
{
dataGridView1.Rows[Rowx].DefaultCellStyle.ForeColor = Color.Red;
dataGridView1.CurrentCell.Value = "卖出";
dataGridView1.CurrentCell.Tag = "卖出";
} }我选择买入或卖出的时候,这一行另一个单元格的内容就会跟着变.
该怎么写...
谢谢
{
int Rowx = dataGridView1.CurrentCell.RowIndex;
if (((ComboBox)sender).Text == "买入")
{
dataGridView1.Rows[Rowx].DefaultCellStyle.ForeColor = Color.Blue; dataGridView1.CurrentCell.Value = "买入";
dataGridView1.CurrentCell.Tag = "买入";
}
else
{
dataGridView1.Rows[Rowx].DefaultCellStyle.ForeColor = Color.Red;
dataGridView1.CurrentCell.Value = "卖出";
dataGridView1.CurrentCell.Tag = "卖出";
} }我选择买入或卖出的时候,这一行另一个单元格的内容就会跟着变.
该怎么写...
谢谢
解决方案 »
- 当前上下文中不存在"panel1"
- vs2005 安装包制作 如何取得每个按钮事件
- 类,接口!
- 我是新手大家帮我看看这段代码有什么问题谢谢
- 遍历image中所有像素,取指定颜色的像素量,VB6结果无误,却无法用C#得出正确结果JJJJJ JJJJJJJ JJJJJJ JJJJJJ
- 数据库发布问题(Sql Server 2000)
- list<> 转换为数组的问题
- 【求助】关于项目安全和保密的方案求助
- sandcastle生成的chm,只有一个类,怎么回事啊
- 不同窗体间传递数据集问题
- 创建一个窗体中的BUTTON控件 此控件的名字是拼出来的 在创建的同时需要填写他的click事件 我不知道该怎么写了 下面是我的代码
- 关于LINQ调用存储过程的问题
//处理EditingControlShowing事件
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
//获取正在编辑的单元格,如果是combobox,则为其挂接事件处理程序:
ComboBox combo = e.Control as ComboBox;
if (combo != null)
{
combo.SelectedIndexChanged +=
new EventHandler(ComboBox_SelectedIndexChanged);
}
}//当下拉框内容修改后,会触发这个事件处理程序,你在这里处理。
private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
//
}
DataGridViewEditingControlShowingEventArgs e)
{
ComboBox combo = e.Control as ComboBox;
if (combo != null)
{
combo.SelectedIndexChanged +=
new EventHandler(ComboBox_SelectedIndexChanged);
}
}
private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox cb=(ComboBox)sender;
}