View Single Post
  #2 (permalink)  
Old September 5th, 2013, 12:20 PM
Rod Stephens's Avatar
Rod Stephens Rod Stephens is offline
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts

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 Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote