ti在DataGridView的组合框中找到“选定的索引更改事件"的位置 [英] Where ti find Selected Index Change Event in Combobox in DataGridView

查看:109
本文介绍了ti在DataGridView的组合框中找到“选定的索引更改事件"的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行时在此DataGridView中创建一个DataGridView,当组合框选择了索引更改了如何定义以及定义的位置时,还创建了一个组合框.

I Create a DataGridView At RunTime In This DataGridView Also Create a ComboBox when Combobox selected Index Changed How to Define And Where it Define.

this.TrGrid = new System.Windows.Forms.DataGridView();
this.TrNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.TrName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Arr_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Dep_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Late_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Stat = new System.Windows.Forms.DataGridViewTextBoxColumn();
//this.Pf = new System.Windows.Forms.DataGridViewTextBoxColumn();
//this.Stat = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.Pf = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.Cg = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.TI = new System.Windows.Forms.DataGridViewCheckBoxColumn();


this.TrGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.TrGrid.Location = new System.Drawing.Point(0, 30);
this.TrGrid.Name = "TrGrid";
this.TrGrid.Size = new System.Drawing.Size(945, 485);
this.TrGrid.TabIndex = 0;
this.TrGrid.AllowUserToAddRows = false;
this.TrGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.On_Cell_Content_Click);
this.TrGrid.CellClick += new DataGridViewCellEventHandler(this.TrGrid_CellClick);
this.TrGrid.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.On_Cell_Enter);
this.TrGrid.CellLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.On_Cell_Leave);
this.TrNo.HeaderText = "Train No";
this.TrNo.Name = "Train No";
this.TrNo.DataPropertyName = "Train_No";
this.TrNo.Width = 90;
//this.TrGrid.Columns.Add(TrNo);
this.TrGrid.Columns.Insert(0,TrNo);

this.TrName.HeaderText = "Tr_Name_Eng";
this.TrName.Name = "Tr_Name_Eng";
this.TrName.DataPropertyName = "Tr_Name_Eng";
this.TrName.Width = 210;
this.TrGrid.Columns.Insert(1,TrName);

this.Arr_Time.HeaderText = "Arr_Time";
this.Arr_Time.Name = "Arr_Time";
this.Arr_Time.DataPropertyName = "Arr_Time";
this.Arr_Time.Width = 80;
this.TrGrid.Columns.Insert(2,Arr_Time);

this.Dep_Time.HeaderText = "Dep_Time";
this.Dep_Time.Name = "Dep_Time";
this.Dep_Time.DataPropertyName = "Dep_Time";
this.Dep_Time.Width = 80;
this.TrGrid.Columns.Insert(3,Dep_Time);

this.Late_Time.HeaderText = "Late_Time";
this.Late_Time.Name = "Late_Time";
this.Late_Time.DataPropertyName = "Late_Time";
this.Late_Time.Width = 80;
this.TrGrid.Columns.Insert(4,Late_Time);

this.Stat.HeaderText = "Status";
this.Stat.Name = "Status";
this.Stat.DataPropertyName = "Status";
//this.Stat.DisplayMember = "Status";
//this.Stat.DataSource = Get_Status();
this.Stat.Width = 200;
this.TrGrid.Columns.Insert(5,Stat);

this.Pf.HeaderText = "Pf_No";
this.Pf.Name = "Pf_No";
this.Pf.DataPropertyName = "Pf_No";
this.Pf.DisplayMember = "Pf_No";
this.Pf.DataSource = get_table();
this.Pf.Width = 50;
this.TrGrid.Columns.Insert(6,Pf);

this.Cg.HeaderText = "Cg_Disp";
this.Cg.Name = "Cg_Disp";
this.Cg.DataPropertyName = "Cg_Disp";
this.Cg.TrueValue = "1";
this.Cg.FalseValue = "0";
this.Cg.Width = 50;
this.TrGrid.Columns.Insert(7, Cg);

this.TI.HeaderText = "Tr_Disp";
this.TI.Name = "Tr_Disp";
this.TI.DataPropertyName = "Tr_Disp";
this.TI.TrueValue = "1";
this.TI.FalseValue = "0";
this.TI.Width = 50;
this.TrGrid.Columns.Insert(8, TI);


this.Controls.Add(TrGrid);

推荐答案

您最好加入CellValueChanged事件.


这篇关于ti在DataGridView的组合框中找到“选定的索引更改事件"的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆