J
jamie
In my code I have a datagrid. When the currentCellchanged event is fired I
draw a textbox overtop of the new currentCell. This works perfectly. I
then call the textbox.focus(); this doesn't work for somereason. I'm
assuming the currentCellchanged event sets focus to the cell after setting
focus to the text box.
Here is the code
Rectangle r = dataGrid1.GetCellBounds(dataGrid1.CurrentCell.RowNumber,
dataGrid1.CurrentCell.ColumnNumber);
r = dataGrid1.RectangleToScreen(r);
this.textBox1.Top = r.Top -56; // -56 gets the spacing exactly over
the grid
this.textBox1.Left = r.Left-1; // more spacing over the grid
this.textBox1.Width = r.Width;
this.textBox1.Height = r.Height;
this.textBox1.Focus();
Any suggestions?
Jamie
draw a textbox overtop of the new currentCell. This works perfectly. I
then call the textbox.focus(); this doesn't work for somereason. I'm
assuming the currentCellchanged event sets focus to the cell after setting
focus to the text box.
Here is the code
Rectangle r = dataGrid1.GetCellBounds(dataGrid1.CurrentCell.RowNumber,
dataGrid1.CurrentCell.ColumnNumber);
r = dataGrid1.RectangleToScreen(r);
this.textBox1.Top = r.Top -56; // -56 gets the spacing exactly over
the grid
this.textBox1.Left = r.Left-1; // more spacing over the grid
this.textBox1.Width = r.Width;
this.textBox1.Height = r.Height;
this.textBox1.Focus();
Any suggestions?
Jamie