本文整理汇总了C#中System.Windows.Forms.DataGridViewCellEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewCellEventArgs类的具体用法?C# DataGridViewCellEventArgs怎么用?C# DataGridViewCellEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridViewCellEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewCellEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: dataGridView1_CellContentClick
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
SqlConnection con = new SqlConnection(constring);
con.Open();
int curRow = int.Parse(e.RowIndex.ToString());
string currentrow;
currentrow = dataGridView1.Rows[curRow].Cells[1].Value.ToString();
SqlDataAdapter adp1 = new SqlDataAdapter("Select * from ResManagerToAdmin where ResID='" + currentrow + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
SqlCommand cmd = new SqlCommand("Update ResManagerToAdmin set RView='" + p2 + "' where ResID='" + currentrow + "'", con);
cmd.ExecuteNonQuery();
SqlCommand cmd1 = new SqlCommand("Update ResManagerToAdmin set RFinalView='" + p2 + "' where ResID='" + currentrow + "'", con);
cmd1.ExecuteNonQuery();
status = ds1.Tables[0].Rows[0]["RStatus"].ToString();
if (status == "Success")
{
ViewAdminResponses var = new ViewAdminResponses();
var.ShowDialog();
}
else
{
RecordNotFound rnf = new RecordNotFound();
rnf.ShowDialog();
}
}
示例2: dataGridView1_CellDoubleClick
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
History.pid = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
History.pname = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
History h = new History();
h.ShowDialog();
}
示例3: dataGridViewCrs_CellClick
private void dataGridViewCrs_CellClick(object sender, DataGridViewCellEventArgs e)
{
int cnt = 0;
oracleConnection1.Open();
chartCntStd.Series[0].Points.Clear();
dataGridViewResult.Rows.Clear();
string mySQL = "SELECT CRS_NUM, CRS_YEAR, CRS_TERM, COUNT(EN_STD_NUM) AS CNT_STD "
+ "FROM PRO1_COURSES LEFT OUTER JOIN PRO1_ENROLLS ON CRS_YEAR = EN_CRS_YEAR AND CRS_TERM = EN_CRS_TERM AND CRS_NUM = EN_CRS_NUM "
+ "GROUP BY CRS_NUM, CRS_YEAR, CRS_TERM";
oracleCommand1.CommandText = mySQL + " HAVING CRS_NUM IN " + "'" + dataGridViewCrs.CurrentRow.Cells[0].Value.ToString() + "'";
OracleDataReader rdr1 = oracleCommand1.ExecuteReader();
while (rdr1.Read())
{
dataGridViewResult.Rows.Add();
dataGridViewResult.Rows[cnt].Cells[0].Value = rdr1["CRS_YEAR"];
dataGridViewResult.Rows[cnt].Cells[1].Value = rdr1["CRS_TERM"];
dataGridViewResult.Rows[cnt].Cells[2].Value = rdr1["CNT_STD"];
chartCntStd.Series[0].Points.AddXY(rdr1["CRS_YEAR"], rdr1["CNT_STD"]);
cnt++;
}
if (!avgFlag)
{
oracleCommand2.CommandText = "SELECT CRS_YEAR, CRS_TERM, ROUND(AVG(CNT_STD),0) AS AVG_STD " +
"FROM (" + mySQL + ") GROUP BY CRS_YEAR, CRS_TERM";
OracleDataReader rdr2 = oracleCommand2.ExecuteReader();
while (rdr2.Read())
{
chartCntStd.Series[1].Points.AddXY(rdr2["CRS_YEAR"], Convert.ToInt32(rdr2["AVG_STD"]));
}
avgFlag = true;
rdr2.Close();
}
rdr1.Close();
oracleConnection1.Close();
}
示例4: dgvCalendar_CellEnter
private void dgvCalendar_CellEnter(object sender, DataGridViewCellEventArgs e)
{
try
{
DataGridView dgv = (DataGridView)sender;
bool state = !dgv.CurrentRow.IsNewRow ? true : false;
switch (lang)
{
case "calendarfa":
tmiCalendarEdit.Enabled = state;
tmiCalendarErase.Enabled = state;
break;
case "calendaren":
tmiCalendarEditEn.Enabled = state;
tmiCalendarEraseEn.Enabled = state;
break;
case "calendarar":
tmiCalendarEditAr.Enabled = state;
tmiCalendarEraseAr.Enabled = state;
break;
default:
break;
}
miCalendarEdit.Enabled = state;
miCalendarErase.Enabled = state;
}
catch
{
}
}
示例5: dgvTSRecord_CellClick
private void dgvTSRecord_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (timeSheetFSWorkingDaysBindingSource.Current == null)
{
return;
}
if (dgvTSRecord.Columns[e.ColumnIndex].DataPropertyName == "IsClosed")
{
if (!(timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).IsCreated)
{
MessageBox.Show("Выбранная запись еще не добавлена в табель!");
return;
}
if ((timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).TimeSheetFSRecord.TimeSheet.IsClosed == true)
{
MessageBox.Show("Табель рабочего времени закрыт для редактирования!");
return;
}
//зафиксировано - устанавливаем
if ((timeSheetFSWorkingDaysBindingSource.Current != null) &&
((timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).IsCreated))
{
(timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).TimeSheetFSRecord.IsClosed =
!(timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).TimeSheetFSRecord.IsClosed;
KadrController.Instance.Model.SubmitChanges();
}
}
}
示例6: jokasoDaichoListDataGridView_CellDoubleClick
private void jokasoDaichoListDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
string hokenjoCd, torokuNengetsu, renban;
TraceLog.StartWrite(MethodInfo.GetCurrentMethod());
Cursor preCursor = Cursor.Current;
try
{
Cursor.Current = Cursors.WaitCursor;
if (e.RowIndex > -1)
{
hokenjoCd = jokasoDaichoListDataGridView.Rows[e.RowIndex].Cells[0].Value.ToString();
torokuNengetsu = jokasoDaichoListDataGridView.Rows[e.RowIndex].Cells[1].Value.ToString();
renban = jokasoDaichoListDataGridView.Rows[e.RowIndex].Cells[2].Value.ToString();
JokasoDaichoShosai frm = new JokasoDaichoShosai(hokenjoCd, torokuNengetsu, renban);
Program.mForm.ShowForm(frm);
}
}
catch (Exception ex)
{
TraceLog.ErrorWrite(MethodInfo.GetCurrentMethod(), ex.ToString());
MessageForm.Show(MessageForm.DispModeType.Error, MessageResouce.MSGID_E00001, ex.Message);
}
finally
{
Cursor.Current = preCursor;
TraceLog.EndWrite(MethodInfo.GetCurrentMethod());
}
}
示例7: dataGridViewCSharp_CellEnter
private void dataGridViewCSharp_CellEnter(object sender, DataGridViewCellEventArgs e)
{
DotNetType dotnetType = (DotNetType)((DataGridView)sender).Rows[e.RowIndex].Tag;
if (dotnetType == null)
{
labelUsedBy.Text = "";
return;
}
labelUsedBy.BeginUpdate();
StringBuilder sb = new StringBuilder();
sb.AppendLine("<br/><br/>");
//sb.AppendFormat("<br/>{0}UniType: <b>{1}</b>", SPACE, dotnetType.Name);
//sb.AppendFormat("<br/>{0}C# type: <b>{1}</b>", SPACE, dotnetType.CSharpType);
//sb.AppendLine("<br/><br/>");
sb.AppendFormat("<br/>{0}<b>DB types that map to this:</b><br/><br/>", SPACE);
sb.Append(GetDisplayTextForTypeUsages("SQL Server Types", Utility.SqlServerTypes, dotnetType));
sb.Append(GetDisplayTextForTypeUsages("Oracle Types", Utility.OracleTypes, dotnetType));
sb.Append(GetDisplayTextForTypeUsages("MySQL Types", Utility.MySqlTypes, dotnetType));
sb.Append(GetDisplayTextForTypeUsages("PostgreSQL Types", Utility.PostgreSqlTypes, dotnetType));
sb.Append(GetDisplayTextForTypeUsages("Firebird Types", Utility.FirebirdTypes, dotnetType));
sb.Append(GetDisplayTextForTypeUsages("SQLite Types", Utility.SQLiteTypes, dotnetType));
labelUsedBy.Text = sb.ToString();
labelUsedBy.EndUpdate();
}
示例8: OnGridWasClicked
private void OnGridWasClicked(object sender, DataGridViewCellEventArgs e)
{
var grid = sender as DataGridView;
if(null == grid)
return;
int rowIndex = e.RowIndex;
if(rowIndex< 0)
return;
var row = grid.Rows[rowIndex];
int w = (int) row.Tag;
var limitation = grid.Tag as WeightLimitation;
if(null == limitation)
return;
if(limitation.ContainsWeight(w))
{
limitation.Remove(w);
}
else
{
limitation.Add(w);
}
PaintRow(grid, rowIndex);
_fullSystem.NeedsToBeCounted = true;
_fullSystem.NeedsToBeSaved = true;
}
示例9: dataGridViewDTE_CellDoubleClick
private void dataGridViewDTE_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
_pin.command(String.Format("{0}", dataGridViewDTE[0, e.RowIndex].Value));
dataGridViewDTE.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = Color.FromArgb(245, 242, 203);
dataGridViewDTE.Rows[e.RowIndex].DefaultCellStyle.SelectionForeColor = Color.FromArgb(23, 36, 47);
}
示例10: dgvLoaithuoc_CellContentClick
private void dgvLoaithuoc_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
txtMaLT.DataBindings.Clear();
txtMaLT.DataBindings.Add("Text", dgvLoaithuoc.DataSource, "MaLoai");
txtTenLT.DataBindings.Clear();
txtTenLT.DataBindings.Add("Text", dgvLoaithuoc.DataSource, "Ten");
}
示例11: dataGridView1_CellClick
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == ColDelete.Index)
{
dataGridView1.Rows.RemoveAt(e.RowIndex);
}
}
示例12: dgLedger_CellContentDoubleClick
private void dgLedger_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
sResult = dgLedger.SelectedRows[0].Cells[0].Value.ToString();
sDescription = dgLedger.SelectedRows[0].Cells[1].Value.ToString();
this.DialogResult = DialogResult.OK;
this.Close();
}
示例13: dataGridView1_CellContentClick
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (e.RowIndex >= 0)
{
DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
string serialNo = row.Cells["S.No"].Value.ToString();
DBManager manager=new DBManager();
SqlConnection connection = manager.Connection();
string query = "delete from Books Where [S.No]='" + serialNo + "'";
SqlCommand delCommand=new SqlCommand(query,connection);
connection.Open();
System.Windows.Forms.DialogResult result =
MessageBox.Show("Do you wnat to delete the selected book?", "Message", MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
delCommand.ExecuteNonQuery();
MessageBox.Show("deleted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
TestBook();
}
}
}
catch (Exception exception)
{
MessageBox.Show(exception.StackTrace);
}
}
示例14: dataGridViewNCC_CellClick
private void dataGridViewNCC_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
DataGridViewRow row = this.dataGridViewNCC.Rows[e.RowIndex];
txtTenNCC.Text = row.Cells[0].Value.ToString();
}
DAL.DALNhaCungCap.layNCCtheoten(txtTenNCC.Text);
BUSNhaCungCap bNCC = new BUSNhaCungCap();
var NCC = bNCC.layNCCtheoten(txtTenNCC.Text);
if (NCC == null)
{
MessageBox.Show("Không tồn tại nhà cung cấp");
}
else
{
txtDiaChi.Text = NCC.DiaChi;
txtEmail.Text = NCC.Email;
txtSoDT.Text = NCC.SoDienThoai;
txtTaiKhoan.Text = NCC.IDTaiKhoan;
txtChuTK.Text = NCC.TenChuTK;
dateTimePicker1.Text = Convert.ToString(NCC.NgayMoTK);
txtChitietkhac.Text = NCC.ChiTietKhac;
}
}
示例15: dataGridView1_CellDoubleClick
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
Grados.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
gradoMod = Grados.Text;
try
{
if (con.State != ConnectionState.Open)
con.Open();
SqlCommand cmd2 = new SqlCommand();
cmd2.Connection = con;
cmd2.CommandType = System.Data.CommandType.Text;
cmd2.CommandText = "select ID_GRADO, ID_IND, ID, NOMBRE, VALOR from GRADOS where ID=" + id_eva + " and NOMBRE='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "' group by ID_GRADO, ID_IND, ID, NOMBRE, VALOR ORDER BY ID_GRADO;";
SqlDataAdapter da = new SqlDataAdapter(cmd2);
DataTable dt = new DataTable();
DataSet ds = new DataSet();
da.Fill(ds);
dt = ds.Tables[0];
dataGridView2.DataSource = dt;
}
catch (Exception ene)
{
MessageBox.Show(ene.ToString());
}
finally
{
if (con.State != ConnectionState.Closed)
con.Close();
}
}