• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.DataGridViewCellCancelEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.DataGridViewCellCancelEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewCellCancelEventArgs类的具体用法?C# DataGridViewCellCancelEventArgs怎么用?C# DataGridViewCellCancelEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataGridViewCellCancelEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewCellCancelEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: dgvNews_RowValidating

        /// <summary>
        /// Checks that all required fiels are filled when the user edits a row
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvNews_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (_ignore)
            {
                return;
            }
            bool allCellsOK = true;
            var row = dgvNews.Rows[e.RowIndex];
            NewsSourceType type = cbbSourceType.GetSelectedValue<Tuple<string, NewsSourceType>>().Item2;

            foreach (DataGridViewCell c in row.Cells)
            {
                if (/*c.ColumnIndex == colFilter.Index ||*/ c.ColumnIndex == colRemove.Index)
                {
                    continue;
                }
                if (c.ColumnIndex == colURL.Index && type == NewsSourceType.Twitter)
                {
                    continue;
                }
                if (c.Value == null || c.Value.ToString() == string.Empty)
                {
                    allCellsOK = false;
                    c.ErrorText = "Mandatory";
                }
                else
                {
                    c.ErrorText = string.Empty;
                }
            }
            if (!allCellsOK)
            {
                e.Cancel = true;
            }
        }
开发者ID:erdincay,项目名称:CoinTNet,代码行数:40,代码来源:NewsSourcesForm.cs


示例2: tablaDatos_CellBeginEdit

        private void tablaDatos_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            posReg = e.RowIndex;
            btGurdarReg.Enabled = true;

            if (edicion == false)
                dirBO = -1;
            
            for (int i = 0; i < tablaDatos.Rows.Count; i++)
                if (i != e.RowIndex)
                {
                    tablaDatos.Rows[i].ReadOnly = true;
                    for (int j = 0; j < tablaDatos.Columns.Count; j++)
                        tablaDatos.Rows[i].Cells[j].Style.BackColor = Color.Gray;
                }

            if (tablaDatos.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null && nuevoReg != true && edicion == false)
                nuevoReg = true;

            if (nuevoReg == false && tablaDatos.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null && edicion != true)
            {
                bloqueOriginal = creaBloqueDatos(e.RowIndex);
                getArchivo().AbrirArchivo();
                buscaDirBloque(bloqueOriginal);
                edicion = true;
                getArchivo().CerrarArchivo();
            }
        }
开发者ID:miguellgt,项目名称:file-structures,代码行数:28,代码来源:FOrgHashEstatica.cs


示例3: dataGridView_CellBeginEdit

 /* Начало редактирование ячейки */
 private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     try
     {
         if ((_dataGridView.Focused) && (_dataGridView.CurrentCell.ColumnIndex == _indexColumn))
         {
             _dateTimePicker.Location = _dataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
             _dateTimePicker.Visible = true;
             if (_dataGridView.CurrentCell.Value != DBNull.Value)
             {
                 _dateTimePicker.Value = (DateTime)_dataGridView.CurrentCell.Value;
             }
             else
             {
                 _dateTimePicker.Value = DateTime.Today;
             }
         }
         else
         {
             _dateTimePicker.Visible = false;
         }
     }
     catch (Exception ex)
     {
         if (MessageBox.Show("Произошла ошибка!" + System.Environment.NewLine + "Показать полное сообщение?", "Ошибка:", MessageBoxButtons.YesNo) == DialogResult.Yes)	//Сообщение об ошибке
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
开发者ID:CatfishStudio,项目名称:theater,代码行数:31,代码来源:FieldTableDate.cs


示例4: dataGridView1_CellBeginEdit

 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if(datePicker==null) InitializeDateTimePicker();
     //try
     //{
     if (dataGridView1.Focused && (dataGridView1.CurrentCell.ColumnIndex == 2 || dataGridView1.CurrentCell.ColumnIndex == 3))
         {
             datePicker.Location = dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
             datePicker.Visible = true;
             if (dataGridView1.CurrentCell.Value != DBNull.Value)
             {
                 datePicker.Value = (DateTime)dataGridView1.CurrentCell.Value;
             }
             else
             {
                 datePicker.Value = DateTime.Today;
             }
         }
         else
         {
             datePicker.Visible = false;
         }
     //}
     //catch (Exception ex)
     //{
         //MessageBox.Show("Malformet date format: "+ex.Message);
     //}
 }
开发者ID:JoelEspinal,项目名称:AirLine,代码行数:28,代码来源:FligthForm.cs


示例5: dgvThongTin_CellBeginEdit

 private void dgvThongTin_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     //if (dgvThongTin[colGia.Name, e.RowIndex].Value != null)
     //{
     //    dgvThongTin[colGia.Name, e.RowIndex].Value = dgvThongTin[colGia.Name, e.RowIndex].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty);
     //}
 }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:7,代码来源:UcKhuyenMai.cs


示例6: dataGridView1_CellBeginEdit

 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (!dataGridView1.Rows[e.RowIndex].IsNewRow)
     {
         db.InjectDataBeforeCommitEvent(dataGridView1, e.RowIndex);
     }
 }
开发者ID:plamikcho,项目名称:event-tracker,代码行数:7,代码来源:FormEvent.cs


示例7: gridHeaders_CellBeginEdit

 private void gridHeaders_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
   try
   {
     if (e.ColumnIndex >= 0 && e.RowIndex >= 0
       && gridHeaders.Columns[e.ColumnIndex].DataPropertyName == "Value")
     {
       switch ((string)gridHeaders.Rows[e.RowIndex].Cells["colName"].Value)
       {
         case "LOCALE":
           colValue.DisplayMember = "DisplayName";
           colValue.ValueMember = "Name";
           colValue.DataSource = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
             .OrderBy(v => v.DisplayName).ToList();
           break;
         case "TIMEZONE_NAME":
           colValue.DisplayMember = "DisplayName";
           colValue.ValueMember = "Id";
           colValue.DataSource = TimeZoneInfo.GetSystemTimeZones()
             .OrderBy(v => v.BaseUtcOffset.TotalHours).ThenBy(v => v.DisplayName).ToList();
           break;
         default:
           colValue.DataSource = new string[] {};
           break;
       }
     }
   }
   catch (Exception ex)
   {
     Utils.HandleError(ex);
   }
 }
开发者ID:rneuber1,项目名称:InnovatorAdmin,代码行数:32,代码来源:ConnectionAdvancedDialog.cs


示例8: dataGridView1_CellBeginEdit

 /******************************************************************************************************************************************************/
 /***********After the spreadsheet has been created most of the program calls are made from these two functions***************/
 //These two functions were the trickiest part of the assignment. They pretty much call and moniter the entire editing process
 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs grid)
 {
     UpdateMenu();
     //Make a temp cell and set it equal to the cell passed in
     SpreadSheetCell currCell = mySheet.getCell(grid.RowIndex, grid.ColumnIndex);
     //Update the value in the cell and the index of the cell
     dataGridView1.Rows[grid.RowIndex].Cells[grid.ColumnIndex].Value = currCell.getText();
 }
开发者ID:nodes11,项目名称:Spreadsheet,代码行数:11,代码来源:Form1.cs


示例9: dataGridView1_RowValidating

 private void dataGridView1_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
 {
     //проверяем, чтобы было заполнена ПК группа
     if ((pKCategoryBindingSource.Current != null)
         &&((pKCategoryBindingSource.Current as PKCategory).PKCategoryNumber != 0)
         && (cbPKGroup.SelectedItem != null))
         (pKCategoryBindingSource.Current as PKCategory).PKGroup =
                 cbPKGroup.SelectedItem as PKGroup;
 }
开发者ID:UGTU,项目名称:UGTUKadrProject,代码行数:9,代码来源:PKCategoryDialog.cs


示例10: dataGridView_CellBeginEdit

 private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (dataGridView.SelectedCells.Count > 1)
     {
         MessageBox.Show("Для правки выберите только одну ячейку!");
         e.Cancel = true;
         return;
     }
 }
开发者ID:EvgenyShishko,项目名称:KDZ_Variant_11,代码行数:9,代码来源:Form1.cs


示例11: dataView_CellBeginEdit

        private void dataView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            _currentEditIndex = e.RowIndex;
            if(_currentEditIndex<0)
                return;

            dataView.ClearSelection();

            _savedValue = (string) dataView.Rows[_currentEditIndex].Cells[0].Value;
        }
开发者ID:GAIPS-INESC-ID,项目名称:FAtiMA-Toolkit,代码行数:10,代码来源:ConditionSetEditorControl.cs


示例12: dataGridView1_RowValidating

 private void dataGridView1_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
 {
     //проверяем, чтобы были заполнены какие-то поля
     if ((prikazTypeBindingSource.Current != null)
         && ((prikazTypeBindingSource.Current as PrikazType).PrikazTypeName != "")
         && ((prikazTypeBindingSource.Current as PrikazType).PrikazTypeName != null)
         && (cbPrikazSuperType.SelectedItem != null))
         (prikazTypeBindingSource.Current as PrikazType).PrikazSuperType =
                 cbPrikazSuperType.SelectedItem as PrikazSuperType;
 }
开发者ID:UGTU,项目名称:UGTUKadrProject,代码行数:10,代码来源:PrikazTypeDialog.cs


示例13: GridViewOnCellBeginEdit

        private static void GridViewOnCellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            var gridView = (DataGridView)sender;

            var cell = gridView.Rows[e.RowIndex].Cells[0];
            var bindingSource = (BindingSource)gridView.DataSource;

            if (string.IsNullOrWhiteSpace(cell.Value as string))
                ((ColorerFormatSetting)bindingSource.Current).ClassificationType = string.Format("OutputColorer.{0}", Guid.NewGuid());
        }
开发者ID:me-viper,项目名称:OutputColorer,代码行数:10,代码来源:OutputColorerOptions.cs


示例14: dgvProcesses_CellBeginEdit

 private void dgvProcesses_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (e.ColumnIndex == 1)
     {
         if (Convert.ToString(dgvProcesses.SelectedCells[0].Value) == "")
         {
             dgvProcesses.Rows[e.RowIndex].Cells[0].Value = e.RowIndex + 1;
         }
     }
 }
开发者ID:AkshayaInfo,项目名称:Ganga,代码行数:10,代码来源:fclsProductCategoryMaster.cs


示例15: dgvBonusType_RowValidating

 private void dgvBonusType_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
 {
     //проверяем, чтобы было заполнено название вида надбавки
     if ((bonusTypeBindingSource.Current != null)
         &&((bonusTypeBindingSource.Current as BonusType).BonusTypeName != "")
         && ((bonusTypeBindingSource.Current as BonusType).BonusTypeName != null)
         && (cbBonusSuperType.SelectedItem != null))
         (bonusTypeBindingSource.Current as BonusType).BonusSuperType =
                 cbBonusSuperType.SelectedItem as BonusSuperType;
 }
开发者ID:UGTU,项目名称:UGTUKadrProject,代码行数:10,代码来源:BonusTypeDialog.cs


示例16: dataGridView1_CellBeginEdit

 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     Regex nums = new Regex(@"^[0123456789]*$");
     if (nums.IsMatch(dataGridView1.CurrentRow.Cells[2].Value.ToString()))
     {
     }
     else
     {
         dataGridView1.CurrentRow.Cells[2].Value = "0";
     }
 }
开发者ID:sydricksamonte,项目名称:blue-silver-convenience,代码行数:11,代码来源:Voids.cs


示例17: dataGridView1_CellBeginEdit_1

        private void dataGridView1_CellBeginEdit_1(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (null == currSheet) { return; }

            else
            {
                DataGridViewCell gridCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                SpreadsheetEngine.Cell spreadCell = currSheet.GetCell(e.RowIndex, e.ColumnIndex);
                gridCell.Value = spreadCell.Text;
            }
        }
开发者ID:russvick,项目名称:CS322,代码行数:11,代码来源:Form1.cs


示例18: dgvKBList_CellBeginEdit

        private void dgvKBList_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            int ofs = 0, i = 0, id_cate_main = -1, h = 15 * 5;

            if (("品名" == dgvKBList.Columns[e.ColumnIndex].HeaderText) ||
                ("場所" == dgvKBList.Columns[e.ColumnIndex].HeaderText) ||
                ("メモ" == dgvKBList.Columns[e.ColumnIndex].HeaderText))
            {
                dgvKBList.ImeMode = System.Windows.Forms.ImeMode.Hiragana;
            }

            ofs = dgvKBList.RowHeadersWidth;
            for (i = 0; i < e.ColumnIndex; i++)
            {
                ofs += dgvKBList.Columns[i].Width;
            }
            if ("費目" == dgvKBList.Columns[e.ColumnIndex].HeaderText)
            {
                if (lstCateMain.Items.Count < 5)
                {
                    h = lstCateMain.Items.Count * 15;
                }

                lstCateMain.SetBounds(dgvKBList.Location.X + ofs, dgvKBList.Location.Y + dgvKBList.Rows[0].Height * (e.RowIndex + 2), 100, h);
                lstCateMain.Visible = true;
            }
            else if ("詳細" == dgvKBList.Columns[e.ColumnIndex].HeaderText)
            {
                bool entry = false;
                string str = "";
                lstCateSub.Items.Clear();

                if (null == dgvKBList.Rows[e.RowIndex].Cells["col_cate_main"].Value) return;

                id_cate_main = int.Parse(((string)dgvKBList.Rows[e.RowIndex].Cells["col_cate_main"].Value).Split(':')[0].Trim());

                foreach (CateSubRec rec in cate_sub_lst)
                {
                    if (rec.id_cate_main == id_cate_main)
                    {
                        str = String.Format("{0, 3}:{1}", rec.id, rec.name);
                        lstCateSub.Items.Add(str);
                    }
                    else if (entry)
                    {
                        break;
                    }
                }

                lstCateSub.SetBounds(dgvKBList.Location.X + ofs, dgvKBList.Location.Y + dgvKBList.Rows[0].Height * (e.RowIndex + 2), 100, h);
                lstCateSub.Visible = true;
            }
        }
开发者ID:shun,项目名称:Kakeibo,代码行数:53,代码来源:KBDatList.cs


示例19: dataGridView1_CellBeginEdit

 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     //DataGridView dv = new DataGridView();
     if (e.ColumnIndex == 1)
     {
         dv.Parent = this.dataGridView1;
         dv.RowHeadersVisible = false;
         dv.Location = new Point(170, (e.RowIndex + 1) * 20);
         dv.DataSource = instance.GetDrugsByAB("A");
         dv.Show();
     }
 }
开发者ID:qq5013,项目名称:Medical,代码行数:12,代码来源:Form2.cs


示例20: channelDgv_RowValidating

 private void channelDgv_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
 {
     if ((e.RowIndex != -1) && (e.RowIndex != (this.channelDgv.RowCount - 1)))
     {
         string info = string.Empty;
         if (!this.ValidateRowByRowIndex(e.RowIndex, ref info))
         {
             MessageBoxUtil.ShowInfo(info);
             e.Cancel = true;
         }
     }
 }
开发者ID:xiaoyj,项目名称:Space,代码行数:12,代码来源:BandwidthMappingVGridCtrl.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DataGridViewCellEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.DataGridViewCell类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap