brokeMyLegBiking
asked on
DataGridView - programatically hit the F2 key
In the DataGridView my code is adding a new row, after I do this I would like to go ahead and place the cursor inside the first cell so that the user can start editing its value. How can I do this?
(I want to accomplish the same effect as if the user clicked into the cell or hit the F2 key to begin editing it). I'm trying to save the user from having to take this step.
Also, when a user begins typing a new blank row is autogenerated at the bottom. I want to make sure that this new row appears (otherwise it causes problems for my program).
-Joseph
(I want to accomplish the same effect as if the user clicked into the cell or hit the F2 key to begin editing it). I'm trying to save the user from having to take this step.
Also, when a user begins typing a new blank row is autogenerated at the bottom. I want to make sure that this new row appears (otherwise it causes problems for my program).
-Joseph
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That was interesting, but that doesn't qute solve the 2nd issue.
Perhpas if I programmatically send a key to the cell after I put it in edit mode? Is there an easy way to programmatically press a key so that the new row appears? Or is there a better way to make that pesky new row appear?
Perhpas if I programmatically send a key to the cell after I put it in edit mode? Is there an easy way to programmatically press a key so that the new row appears? Or is there a better way to make that pesky new row appear?
does this help?
void Grid_RowsAdded(object sender, DataGridViewRowsAddedEvent Args e)
{
Grid.FirstDisplayedCell = Grid.Rows[e.RowIndex].Cell s[0];
}
void Grid_RowsAdded(object sender, DataGridViewRowsAddedEvent
{
Grid.FirstDisplayedCell = Grid.Rows[e.RowIndex].Cell
}
try this one
Datagridview1.AllowUserToA ddRows = True
Datagridview1.AllowUserToA
ASKER
I solved the issue, by just setting the allowusertoAddRows to false and adding a button. That takes the uncertainty out of it.
-Joseph
-Joseph
ASKER
dataGridView1.CurrentCell = dataGridView1.Rows(dataGri
dataGridView1.BeginEdit(fa
Now I just have to solve the second part of my question.