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 138249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:14:03+00:00 2026-05-11T07:14:03+00:00

I have a DGV in VB.Net 2008 connected to an Access DB table. The

  • 0

I have a DGV in VB.Net 2008 connected to an Access DB table. The DGV is not Read Only, but is full of read-only columns except for one, which contains a combo box. The combo box allows the user to select an outcome for that particular row, and then the program copies in a pre calculated value into the ‘Profit’ column depending upon the item selected in the combobox. Then the user hits the Save button and the DB updates (currently via SQL methods in the XSD).

Easy enough so far.

Here is the code.

Private Sub DGUserBets_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DGUserBets.EditingControlShowing      Dim combo As ComboBox = CType(e.Control, ComboBox)      If (combo IsNot Nothing) Then           // Remove an existing event-handler, if present, to avoid           // adding multiple handlers when the editing control is reused.         RemoveHandler combo.SelectedIndexChanged, _             New EventHandler(AddressOf DGUBStake_SelectedIndexChanged)          // Add the event handler.          AddHandler combo.SelectedIndexChanged, _             New EventHandler(AddressOf DGUBStake_SelectedIndexChanged)      End If  End Sub   Private Sub DGUBStake_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)      Dim myStatus As ComboBox = CType(sender, ComboBox)      Dim row = DGUserBets.CurrentRow      Select Case myStatus.SelectedIndex         Case 0             row.Cells('DGUBProfit').Value = 0             // pending. no action         Case 1             row.Cells('DGUBProfit').Value = row.Cells('DGUBIfWin').Value             // win         Case 2             // loses             row.Cells('DGUBProfit').Value = row.Cells('DGUBIfLose').Value         Case 3             // void             row.Cells('DGUBProfit').Value = 0     End Select   End Sub 

The problem I have is that it would seem that if a user selects the desired outcome from the combobox but does NOT hit Enter, and simply mouses on to a different combobox to again select the outcome for a different row, the first eventhandler is not disconnected and thus the events fire multiple times. This then causes various default MsgBox errors and brings up problems when the user tries to commit all changes to the DB/exit program etc etc.

What do I need to do? Do I need to .EndEdit somewhere appropriate to force the row to save the changes? And where should I call this?

Thank you.

  • 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. 2026-05-11T07:14:04+00:00Added an answer on May 11, 2026 at 7:14 am

    A quick glance at the code brings up this question: If you create a new EventHandler when removing the existing one is it the same one?

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

Sidebar

Ask A Question

Stats

  • Questions 244k
  • Answers 244k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Java ships with annotation processor capabilities, starting from Java 6:… May 13, 2026 at 8:01 am
  • Editorial Team
    Editorial Team added an answer Actually this is a fairly simple template use-case, Qt Creator… May 13, 2026 at 8:01 am
  • Editorial Team
    Editorial Team added an answer For cases as these I use those two custom steps:… May 13, 2026 at 8:01 am

Related Questions

In VB.net 3.5 SP1 I have a Windows Form with three DataGridView controls. One
I have a non databound DGV (no datasource, etc; rows added manually). To filter
I have a DataTable bound to a DataGridView. I have FullRowSelect enabled in the
I have a DataViewGrid I populated from a DataTable in a query to a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.