Wrox Programmer Forums
|
BOOK: Visual Basic 2012 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2012 Programmer's Reference by Rod Stephens; ISBN: 978-1-1183-1407-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2012 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 4th, 2013, 10:39 PM
Registered User
 
Join Date: Sep 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb 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.

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
 
Old September 5th, 2013, 12:20 PM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

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.)
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 
Old September 6th, 2013, 05:14 AM
Registered User
 
Join Date: Sep 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thank you

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
not like the book in "Chaper 11"-"Ex11_01" Louaih83 BOOK: Ivor Horton's Beginning Visual C++ 2010 0 April 2nd, 2012 09:38 PM
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
Difficulties with "web.config" and "ASPNETDB" CFRham BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 2 July 3rd, 2010 10:19 AM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM





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