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


C# Forms.DataGridViewCellCancelEventArgs类代码示例

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


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


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