p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Visual Basic 2012 Programmer's Reference (http://p2p.wrox.com/forumdisplay.php?f=694)
-   -   Changing DataGridView "Natural" Behavior (http://p2p.wrox.com/showthread.php?t=90859)

zaki September 4th, 2013 10:39 PM

Changing DataGridView "Natural" Behavior
 
Hi Rod,

[:(]Every times I'm typing on a cell in the last row on the DataGridView, a new row will automaticaly added below.

[:confused:]How to stop this behavior? because I want to be able adding row to the DataGridView by pressing the enter key not automaticaly.

[:)]I look forward to your reply and as always, I really appreciate your help.


Sincerely,

Zaki

Rod Stephens September 5th, 2013 12:20 PM

Sorry but I don't know how to do that.

You can set the control's AllowUserToAddRows property to False to prevent them from adding new rows, but then they can't add a new row by pressing Enter either.

You could set AllowUserToAddRows = False and add your own TextBoxes below the control to let them add new rows. Then you could watch for the Enter key and, if they had filled in all of the necessary information, the program could add the new row. That would do more or less what you want, although the user wouldn't type the new information into the DataGridView control.

(My guess is that's the closest you're likely to get.)

zaki September 6th, 2013 05:14 AM

Thank you
 
Thanks rod I appreciate your advice, I'll consider to do that way.


All times are GMT -4. The time now is 01:23 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.