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. .NET (Core and Framework)
  4. Combobox not Responsive

Combobox not Responsive

Scheduled Pinned Locked Moved .NET (Core and Framework)
mobiledatabasebusinessannouncement
8 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.
  • B Offline
    B Offline
    bobbymale77
    wrote on last edited by
    #1

    I can't seem to make the Combobox4 text to reflect the changes made and still pointing to the "Edit..." Dim mylink As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Application.StartupPath + "\Data\BW.mdb") If Me.ComboBox4.Text = "Edit..." Then Dim NewLink As String = InputBox("Type the desired URL to Business Warehouse Inbound", "Business Warehouse SAP") If NewLink.Length > 0 Then Dim Outbound As String = "UPDATE _servername SET Outstring ='" + NewLink + "'" Dim OutFld As OleDb.OleDbCommand = New OleDb.OleDbCommand(Outbound, mylink) Dim affectedrows As Integer mylink.Open() OutFld.Prepare() affectedrows = OutFld.ExecuteNonQuery() mylink.Close() End If End If Dim sql As String = "SELECT * FROM _servername" 'Refresh Dim da = New OleDb.OleDbDataAdapter(sql, mylink) Dim dtSvr As New Data.DataTable("_servername") da.Fill(dtSvr) Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString

    W 1 Reply Last reply
    0
    • B bobbymale77

      I can't seem to make the Combobox4 text to reflect the changes made and still pointing to the "Edit..." Dim mylink As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Application.StartupPath + "\Data\BW.mdb") If Me.ComboBox4.Text = "Edit..." Then Dim NewLink As String = InputBox("Type the desired URL to Business Warehouse Inbound", "Business Warehouse SAP") If NewLink.Length > 0 Then Dim Outbound As String = "UPDATE _servername SET Outstring ='" + NewLink + "'" Dim OutFld As OleDb.OleDbCommand = New OleDb.OleDbCommand(Outbound, mylink) Dim affectedrows As Integer mylink.Open() OutFld.Prepare() affectedrows = OutFld.ExecuteNonQuery() mylink.Close() End If End If Dim sql As String = "SELECT * FROM _servername" 'Refresh Dim da = New OleDb.OleDbDataAdapter(sql, mylink) Dim dtSvr As New Data.DataTable("_servername") da.Fill(dtSvr) Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Is the combobox's DropDownStyle equal to DropDownEditList. If it is, yuo should change it to DropDown. If that's not the case, use debugger to see that the ComboBox4.Text is set correctly. Just a sidenote, you should use parameters in your sql commands instead of concatenating.

      The need to optimize rises from a bad design.My articles[^]

      B 1 Reply Last reply
      0
      • W Wendelius

        Is the combobox's DropDownStyle equal to DropDownEditList. If it is, yuo should change it to DropDown. If that's not the case, use debugger to see that the ComboBox4.Text is set correctly. Just a sidenote, you should use parameters in your sql commands instead of concatenating.

        The need to optimize rises from a bad design.My articles[^]

        B Offline
        B Offline
        bobbymale77
        wrote on last edited by
        #3

        The Combobox4.Text shown correctly then afterwards (like refresh) it went to the selected item called "edit..." see my codes

        W 1 Reply Last reply
        0
        • B bobbymale77

          The Combobox4.Text shown correctly then afterwards (like refresh) it went to the selected item called "edit..." see my codes

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          So do you mean that after executing this line:

          Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString

          the text in combobox is something else than "Edit..."? If so, when does it change back to "Edit..."?

          The need to optimize rises from a bad design.My articles[^]

          B 1 Reply Last reply
          0
          • W Wendelius

            So do you mean that after executing this line:

            Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString

            the text in combobox is something else than "Edit..."? If so, when does it change back to "Edit..."?

            The need to optimize rises from a bad design.My articles[^]

            B Offline
            B Offline
            bobbymale77
            wrote on last edited by
            #5

            I don't know. I even tried to combobox4.Items.Empty() and that would not do anything to make the Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString

            W 1 Reply Last reply
            0
            • B bobbymale77

              I don't know. I even tried to combobox4.Items.Empty() and that would not do anything to make the Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString

              W Offline
              W Offline
              Wendelius
              wrote on last edited by
              #6

              Is the combobox bound to a datasource? Also instead of changing the text, you should try to set the selectedindex. If the text isn't already in the combobox list you can add it through Items collection (or by refreshing bindings if the list comes from a datasource).

              The need to optimize rises from a bad design.My articles[^]

              B 1 Reply Last reply
              0
              • W Wendelius

                Is the combobox bound to a datasource? Also instead of changing the text, you should try to set the selectedindex. If the text isn't already in the combobox list you can add it through Items collection (or by refreshing bindings if the list comes from a datasource).

                The need to optimize rises from a bad design.My articles[^]

                B Offline
                B Offline
                bobbymale77
                wrote on last edited by
                #7

                This is triggered the Combobox4 prior to clicking the dropdown box and pick "Edit..." If edit is picked than the other code kicks in. Does the Combobox look bounded here? Dim mylink As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Application.StartupPath + "\Data\BW.mdb") Dim sql As String Dim da As OleDb.OleDbDataAdapter Dim cmd As OleDb.OleDbCommand Dim objCmd As New OleDb.OleDbCommand Dim ds As New DataSet Dim affectedRows As Integer sql = "SELECT * FROM _servername" 'Reading the all the fields from the MDB file da = New OleDb.OleDbDataAdapter(sql, mylink) Dim dtSvr As New Data.DataTable("_servername") da.Fill(dtSvr) Me.ComboBox3.Text = dtSvr.Rows(0).Item("Instring") Me.ComboBox4.Text = dtSvr.Rows(0).Item("Outstring") Me.Panel2.BringToFront() Me.ComboBox3.Items.Add("Edit...") Me.ComboBox4.Items.Add("Edit...")

                W 1 Reply Last reply
                0
                • B bobbymale77

                  This is triggered the Combobox4 prior to clicking the dropdown box and pick "Edit..." If edit is picked than the other code kicks in. Does the Combobox look bounded here? Dim mylink As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Application.StartupPath + "\Data\BW.mdb") Dim sql As String Dim da As OleDb.OleDbDataAdapter Dim cmd As OleDb.OleDbCommand Dim objCmd As New OleDb.OleDbCommand Dim ds As New DataSet Dim affectedRows As Integer sql = "SELECT * FROM _servername" 'Reading the all the fields from the MDB file da = New OleDb.OleDbDataAdapter(sql, mylink) Dim dtSvr As New Data.DataTable("_servername") da.Fill(dtSvr) Me.ComboBox3.Text = dtSvr.Rows(0).Item("Instring") Me.ComboBox4.Text = dtSvr.Rows(0).Item("Outstring") Me.Panel2.BringToFront() Me.ComboBox3.Items.Add("Edit...") Me.ComboBox4.Items.Add("Edit...")

                  W Offline
                  W Offline
                  Wendelius
                  wrote on last edited by
                  #8

                  No it's not bound based on this, but if you have set the DataSource property in designer it is bound in code-behind file. However, since you have code on several event handlers, I suggest that you put a breakpoint in every eventhandler where combobox4 is modified whether the eventhandler is for combobox4 or another object. When debugging the debugger should hit your breakpoint(s) and give you more info how/why the text is modifed. Perhaps the events are raised in different order than you expect or some code is called, which "resets" that combo.

                  The need to optimize rises from a bad design.My articles[^]

                  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