本文整理汇总了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;
}
}
示例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();
}
}
示例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());
}
}
}
示例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);
//}
}
示例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);
//}
}
示例6: dataGridView1_CellBeginEdit
private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
if (!dataGridView1.Rows[e.RowIndex].IsNewRow)
{
db.InjectDataBeforeCommitEvent(dataGridView1, e.RowIndex);
}
}
示例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);
}
}
示例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();
}
示例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;
}
示例10: dataGridView_CellBeginEdit
private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
if (dataGridView.SelectedCells.Count > 1)
{
MessageBox.Show("Для правки выберите только одну ячейку!");
e.Cancel = true;
return;
}
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
}
}
示例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;
}