Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2012 > BOOK: Visual Basic 2012 Programmer's Reference
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 4th, 2013, 10:39 PM
Registered User
Points: 18, Level: 1
Points: 18, Level: 1 Points: 18, Level: 1 Points: 18, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #2 (permalink)  
Old September 5th, 2013, 12:20 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
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!)
Reply With Quote
  #3 (permalink)  
Old September 6th, 2013, 05:14 AM
Registered User
Points: 18, Level: 1
Points: 18, Level: 1 Points: 18, Level: 1 Points: 18, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04: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



All times are GMT -4. The time now is 02:58 PM.


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