PDA

View Full Version : مشکل با ErrorText در cellvalidating



nima.ni
شنبه 25 شهریور 1391, 08:54 صبح
با سلام
من در رویداد Cellvalidatingیک سری شروط را چک می کنم می خواهم اگر هر شرط برقرار نبود از errortext استفاده کنم اما هیچ آیکون خطایی در گرید نمایش داده نمی شود.به طور مثال:


if (e.FormattedValue.ToString().Trim().Length > 1)
{

dataGridView1.EndEdit();
dataGridView1[e.ColumnIndex, e.RowIndex].Value = string.Empty;
dataGridView1[e.ColumnIndex, e.RowIndex].ErrorText = "ERRRORRR";
e.Cancel = true;
}

Nima_kyan
شنبه 25 شهریور 1391, 11:14 صبح
کد رو به این شکل تغییر بدید احتمالا جواب بده

if (dataGridView1.CurrentCell.Value.ToString().Trim() .Length<1)
{

dataGridView1.EndEdit();
dataGridView1[e.ColumnIndex, e.RowIndex].Value = string.Empty;
dataGridView1[e.ColumnIndex, e.RowIndex].ErrorText = "ERRRORRR";
e.Cancel = true;
}

nima.ni
شنبه 25 شهریور 1391, 12:42 عصر
الان که بررسی می کنم می بینم این مشکل(نشون ندادن آیکون خطا )فقط در سطر اول وجود دارد.چرا؟:متفکر: