当前位置: 首页>>代码示例>>C#>>正文


C# Forms.DataGridViewCellEventArgs类代码示例

本文整理汇总了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();
            }
        }
开发者ID:balajivit1,项目名称:Sourcecode,代码行数:32,代码来源:User.cs

示例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();
 }
开发者ID:evilnapsis,项目名称:inventio-win,代码行数:7,代码来源:Inventory.cs

示例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();
 }
开发者ID:Torhemp,项目名称:University,代码行数:35,代码来源:CntStd.cs

示例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
            {
            }
        }
开发者ID:Siadatian,项目名称:kermanshahchhto.ir,代码行数:33,代码来源:Calendar.cs

示例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();
                }
            }
        }
开发者ID:UGTU,项目名称:UGTUKadrProject,代码行数:31,代码来源:TimeSheetReport.cs

示例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());
            }
        }
开发者ID:25cm,项目名称:HelloWorld,代码行数:32,代码来源:JokasoDaichoList.cs

示例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();
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:27,代码来源:BaseTypeMapEditor.cs

示例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;
        }
开发者ID:jpazarzis,项目名称:hogar,代码行数:33,代码来源:WeightStatisticsForm.cs

示例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);
        }
开发者ID:3F,项目名称:vsCommandEvent,代码行数:7,代码来源:DTECommandsFrm.cs

示例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");
 }
开发者ID:thanphong,项目名称:hospitalmanager-project,代码行数:7,代码来源:LoaiThuoc.cs

示例11: dataGridView1_CellClick

 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == ColDelete.Index)
     {
         dataGridView1.Rows.RemoveAt(e.RowIndex);
     }
 }
开发者ID:gitter-badger,项目名称:DLaB.Xrm.XrmToolBoxTools,代码行数:7,代码来源:SpecifyAttributesDialog.cs

示例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();
 }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:7,代码来源:LedgerZoom.cs

示例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);
            }
        }
开发者ID:salamcseiu21,项目名称:Library-Management-With-CSharp-Desktop-,代码行数:34,代码来源:UpdateUI.cs

示例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;
     }
 }
开发者ID:noface151,项目名称:Project,代码行数:25,代码来源:FrmNhaCungCap.cs

示例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();

            }
        }
开发者ID:josselynmedina,项目名称:SED,代码行数:32,代码来源:EditarGrados.cs


注:本文中的System.Windows.Forms.DataGridViewCellEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。