Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select cell for data entry in DataGridView

Status
Not open for further replies.

WMXTeam

Programmer
Oct 5, 2005
41
US
I have a button on my form that repositions the grid to the top and selects the first (visible) cell in the first row.

The grid is repositioned and the first cell is highlighted in blue; however, the user must select the cell by clicking the mouse or pressing the tab key in order to type in any text. I would like the user to be able to just start typing. I must be missing something and there is an additional property I need to set. Following is my code.

Code:
' set position to top of grid
dataGridSpecs.FirstDisplayedScrollingRowIndex = 0

' highlight first row and first visible column
dataGridSpecs.ClearSelection()
dataGridSpecs.CurrentCell = dataGridSpecs.Rows(0).Cells(1)
dataGridSpecs.CurrentCell.Selected = True

Thanks in advance for your help.
 
Code:
        ' set position to top of grid
        dataGridSpecs.FirstDisplayedScrollingRowIndex = 0

        ' highlight first row and first visible column
        dataGridSpecs.ClearSelection()
        dataGridSpecs.CurrentCell = dataGridSpecs.Rows(0).Cells(1)
        dataGridSpecs.CurrentCell.Selected = True
        [b][COLOR=red]dataGridSpecs.BeginEdit(True)[/color][/b]

Zameer Abdulla
 
Thanks you for the suggestion; however, I tried it and it did not work. The first cell displays a blue bar and does not allow the user to start typing. The user must press the tab key or click on the cell with the mouse to make the cursor change and allow typing.

Any other suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top