Hi Sergey
Thanks for your Quick answer and full info. When I read your answer for first time I was afraid that I cannot understand what should I do! haha as i said I am so new in C#!
But thanks to your Links I figure out how to do it! I did this and It's seems working great:
private void Test_Load(object sender, EventArgs e)
{
NumericUpDownColumn num = new NumericUpDownColumn();
num.Name = "num";
num.HeaderText = "Number";
dgvTest.Columns.Add(num);
dgvTest.EditingControlShowing += dgvTest_SetMyProperties;
}
private void dgvTest_SetMyProperties(object sender, DataGridViewEditingControlShowingEventArgs e)
{
(e.Control as NumericUpDown).Maximum = 600;
(e.Control as NumericUpDown).TextAlign = HorizontalAlignment.Right;
dgvTest.EditingControlShowing -= dgvTest_SetMyProperties;
}
Sergey, Do I use It in right way?
I followed your second suggestion Also I remove the
EditingControlShowing event at the last line of call it. (To make sure it work fine, I use Line Break inside that event too)
There are something strange about this control, when I insert a number and press
Enter key, It will go to next cell, but inserted number will be deleted!!(and sometimes it did not!!) If I press Tab, It will go to next cell but inserted number will be remain!!
Can you help me with that too!?
Thanks for your Time