Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Combo box refresh problem VB .NET

Combo box refresh problem VB .NET

Scheduled Pinned Locked Moved Visual Basic
databasehelpcsharptutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DA_Loring
    wrote on last edited by
    #1

    Hi All, I think I confused the issue when I last posted this so I am trying again. I need to refresh a combobox list (in VB .net) when a new item as been added to the SQL database. I cannot find any example of how this is achieved and it is very different from VB6 which I am used to. I am still trying to get to grips with .net! I have a sub which calls a form so the user can add details of an item, and when it returns from the form (which inserts the item in the database) I need to update the list in the combo box, which is bound to a datasource on the form. I would be most grateful for any assistance David Loring

    David Loring !! Keep Music Live !!

    D 1 Reply Last reply
    0
    • D DA_Loring

      Hi All, I think I confused the issue when I last posted this so I am trying again. I need to refresh a combobox list (in VB .net) when a new item as been added to the SQL database. I cannot find any example of how this is achieved and it is very different from VB6 which I am used to. I am still trying to get to grips with .net! I have a sub which calls a form so the user can add details of an item, and when it returns from the form (which inserts the item in the database) I need to update the list in the combo box, which is bound to a datasource on the form. I would be most grateful for any assistance David Loring

      David Loring !! Keep Music Live !!

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It's done the exact same way to got the data into the ComboBox into the first place. Reload the data from the SQL source and rebind to the combobox.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      D 1 Reply Last reply
      0
      • D Dave Kreskowiak

        It's done the exact same way to got the data into the ComboBox into the first place. Reload the data from the SQL source and rebind to the combobox.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        D Offline
        D Offline
        DA_Loring
        wrote on last edited by
        #3

        Hi Dave I thought I had done this...code below...but it does not seem to refresh Private Sub cmdAddDistrict_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAddDistrict.Click 'Adds a new district to the list Dim frmRD As New RegDistrict_Add Using frmRD frmRD.ShowDialog() CountyForRegDistrictBindingSource.ResetBindings(False) cboRegDistricts.Refresh() End Using End Sub What am I doing wrong??

        David Loring !! Keep Music Live !!

        D 1 Reply Last reply
        0
        • D DA_Loring

          Hi Dave I thought I had done this...code below...but it does not seem to refresh Private Sub cmdAddDistrict_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAddDistrict.Click 'Adds a new district to the list Dim frmRD As New RegDistrict_Add Using frmRD frmRD.ShowDialog() CountyForRegDistrictBindingSource.ResetBindings(False) cboRegDistricts.Refresh() End Using End Sub What am I doing wrong??

          David Loring !! Keep Music Live !!

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          You called ResetBindings. You did NOT re-fetch the data from the database. Calling Refresh on the combobox just redraws the image of the combobox. It doesn't refresh the data in it.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          D 1 Reply Last reply
          0
          • D Dave Kreskowiak

            You called ResetBindings. You did NOT re-fetch the data from the database. Calling Refresh on the combobox just redraws the image of the combobox. It doesn't refresh the data in it.

            Dave Kreskowiak Microsoft MVP - Visual Basic

            D Offline
            D Offline
            DA_Loring
            wrote on last edited by
            #5

            OK, Thanks Dave. I had thought the re-set bindings did that. I will have another go at it.:)

            David Loring !! Keep Music Live !!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups