datagrid focus

  • Thread starter Thread starter Randy Fraser
  • Start date Start date
R

Randy Fraser

Anyone know how to get the cursor to land inside the first column of a
datagrid after an add.

Me.Datagrid1.CurrentCell = New DataGridCell(Me.dataGrid1.CurrentRowIndex, 0)

will set focus but will not place the cursor inside the textbox in the grid.
If I press keys and hit tab, the value

will turn up, but I cannot see the value as I type.

I have tried everything with the exception of what works:-(



Best Regards

Randy
 
Hi Randy

Try this:

CType(me.Datagrid1.TableStyles(0).GridColumnStyles(me.Datagrid1.CurrentCell.
ColumnNumber), DataGridTextBoxColumn).TextBox.Focus()



I am assuming that the current tablestyle is the first one. If not either
put the number of the style or the mapping name for the table style.

I am also assuming that the gridcolumnstyle is a textbox.



Bob Pfeffer
 
Thanks Bob

This has worked better because I get focus on the column but the cursor
still does not want
to land (flash) inside the textbox. If I type and press tab, the text will
show up. It just won't show up as I type. There maybe another event that
is interfearing with it. I will try it on a New form.

Thanks for your help.

Randy
 
Back
Top