TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Richard Blythe
NA
101
0
DataGridView not saving state
Oct 13 2008 3:20 PM
I've ran into a subtle but problematic issue with the DataGridView saving a new row. I have a databound dgv stored in a UserControl and when the user enters values into a field, the values are not updated when the UserControl is closed (removed from the form). To save time I won't do into an explanation on why the dgv resides in a UserControl but I promise that there is a legitimate reason. Does anyone know how to force the dgv to save state of the new row being edited? If the user enters values into a new row and moves to another row, the state is saved but I can't depend on that happening in a real world situation. I have tried: dgv.NotifyCurrentCellDirty(), dgv.EndEdit() etc and nothing is working.
Here is how to replicate this issue. (Maybe a bug)
Try dropping a dgv that is bound to a dataTable into a UserControl. Now drop the UC inside a Form. Have a MenuStrip item that can be clicked to remove the UserControl from the form. Run the application and add some text to the new row at the bottom. Now without moving the cursor to another cell, click the MenuStrip to remove the UserControl. Now run the program again and the new row's state will not be saved. Enter some text again into the new row at the bottom and close the Form this time. The new row should save state this time.
Thanks for any help that can be provided.
Richard
Reply
Answers (
0
)
Numeric TextBox In C#
how to Restrict the Size in Richtextbox to 10 KB