Click here to Skip to main content
14,774,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, I'm making a TPV program, and I whish the user enter tickets directly in a DataGridView control.

My questions are two:
- How to put and view the edit cursor without select the cell, when show datagridview I see first cell (0,0) selected and don't see the edit cursor, I want to see not selected and view de edit cursor without clicking cell.

- How to avoid new row to be created until the user finish enter the previous row, when the user make one keystroke to edit cell automatically creates another row, I don't want this row to be created until all row data was introduced

NOTE: Sorry by my poor english, THANKS
Updated 9-Apr-11 10:26am
Slacker007 9-Apr-11 8:11am
Welcome shozara. No need to apologize for your English skills. Perhaps you can edit this question to be more descriptive in where you are having the problems...some code snippets would really help. Good luck. :)
avigodse 9-Apr-11 9:33am
Please add more tags, like is it windows-form or web-form, and are you using any third party grid etc.

1 solution

If you need to do anything with the DataGridView then you should keep a copy of the DataGridView FAQ (*.doc format)[^], (*.pdf format)[^] handy.

In there you will find a solution to your first problem.
myDataGridView.CurrentCell = myDataGridView.Rows[x].Cells[y];

MSDN page for BeginEdit()[^].

I do not have a solution for your second problem. I do not think that it is possible although someone else might know a way.
[no name] 9-Apr-11 16:07pm
Tanks for your answer, but I try this solution and don't show edit cursor
Henry Minute 9-Apr-11 16:41pm
I have just tested it and it works on my system, but only where the DataSource of my DGV is editable. It does not work for one DGV where the DataSource is a View, rather than a table. Could this be the case in your situation.
[no name] 9-Apr-11 17:00pm
Is an unconnected DGV and it don´t have DataSource, althought I make an AutoCompleteStringCollection for this cell.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900