當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。