Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6556643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:58:15+00:00 2026-05-25T12:58:15+00:00

Using the walkthrough from [[http://msdn.microsoft.com/de-de/library/15a31akc.aspx]], I implemented a DatagridView in virtual mode, totally unbound,

  • 0

Using the walkthrough from [[http://msdn.microsoft.com/de-de/library/15a31akc.aspx]], I implemented a DatagridView in virtual mode, totally unbound, in VB 10 Express (we are talking WinForms).

I understand that CommitEdit (DataGridViewDataErrorContexts.Commit) commits the current cell’s contents to the data cache.

The example uses row-level commit, i.e. it pushes the values into a row buffer until the current row is left. Only then the row is added to (or updated in) the data store. That’s exactly what I do, too.

Question — how can I commit the current row programmatically without leaving it? (I want to commit the whole row, not just the current cell.)

If the user leaves the row, there is a RowValidating, RowValidated, RowEnter event sequence where the datastore update is taken care of. So one idea (currently my only one) was to simply re-set CurrentCell to Nothing, for example.

But I cannot just set the DataGridView‘s CurrentCell property to Nothing (or any cell outside of the current row) since I want to commit from within an event handler of a custom edit control created by a custom column, and I see an System.InvalidOperationException exception when setting CurrentCell there.

In fact, it is a tiny button right to a combo box, i.e. I create a DataGridViewComboBoxCell descendant which is a DataGridViewComboBoxColumn descendant’s edit control. My special ComboBox cell adds a tiny button which should commit the current row. Unfortunately, that button’s _Click event handler cannot change CurrentCell since DetachEditingControl throws the exception then.

Obviously, I must delay the CurrentCell re-assignment until the whole _Click event has been processed. Or what? How would I do that — register a custom Windows message, SendMessage that one to me, and override the windows procedure of the form so it re-sets CurrentCell when this message is received? (Hello?)

There should be a rather easy way to let DataGridView commit all changes by firing the events that I handle to perform the datastore update, no?

I hope it is somewhat clear what I am talking about. I do not have a compact code example yet 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:58:15+00:00Added an answer on May 25, 2026 at 12:58 pm

    Here is a reliable way to commit the current row:

    ' Optional: mark the current cell as dirty so the current row definetely will be
    ' commited:
    MyDataGridView.NotifyCurrentCellDirty(True)
    
    ' Aktuelle Row commiten. Einen besseren Weg als "Keine Zelle selektieren, dann Originalzelle wieder selektieren" kenne ich nicht:
    Dim OrigCellAddress As Point = New Point(MyDataGridView.CurrentCellAddress.X, MyDataGridView.CurrentCellAddress.Y)
    MyDataGridView.CurrentCell = Nothing
    MyDataGridView.CurrentCell = MyDataGridView.Rows(OrigCellAddress.Y).Cells(OrigCellAddress.X)
    

    The problem with the exception was a BeginEdit/EndEdit sequence i perform in my RowEnter event handler 🙁 which resulted in an indirect recursive call of non-reentrant stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a Custom STS using the claims walkthrough here: http://msdn.microsoft.com/en-us/library/ff955607.aspx . I
I'm following this walktrough: http://msdn.microsoft.com/en-us/library/879kf95c.aspx to add user login and register pages using out-of-the-box
I'm trying to get the Registration-Free Activation of COM Components: A Walkthrough sample from
I want to redirect all my pages from example.com/video_player/vidinfo/456/game/halo-reach-coop-walkthrough-gameplay-in-hd/vtype/sd/ to example.com/video_player/vidinfo/456/game/halo-reach-coop-walkthrough-gameplay-in-hd/ using 301 redirects
I have been following this nice walkthrough for creating a grid using MVC contrib.
I am just trying to walk through this tutorial http://jimneath.org/2011/03/24/using-redis-with-ruby-on-rails.html#redis_and_rails And when I put
I'm using ajax to retrieve some data from the backend. I get the result
I was reading Walkthrough: Creating an Asynchronous HTTP Handler and noticed they pass the
I was following this tutorial: http://blog.johanneshoppe.de/2010/10/walkthrough-ado-net-unit-testable-repository-generator/ And I had this issue: MVC3 & EF.
I'm building a little walkthrough type guide with tooltips using jquery. When the page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.