C# Combobox SelectedIndexChanged - Combobox clears the selection?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • somacore
    New Member
    • Apr 2008
    • 24

    #1

    C# Combobox SelectedIndexChanged - Combobox clears the selection?

    Quick question,

    Is there a way to preserve the value in my combobox when it fires a SelectedIndexCh anged event?

    Right now I have 4 comboboxes all linked together with an SQL query:

    Site
    City
    Manager name
    Phone number

    When I choose the Site name, the event fires and populates the other three boxes, but clears out the Site name box. Why is that?
  • mikeyeli
    New Member
    • Oct 2007
    • 63

    #2
    is this a web application or winform application?

    Comment

    • somacore
      New Member
      • Apr 2008
      • 24

      #3
      Originally posted by mikeyeli
      is this a web application or winform application?
      Sorry, this is a winform app.

      Comment

      • mikeyeli
        New Member
        • Oct 2007
        • 63

        #4
        this is a weird behaviour could you post some code?

        Comment

        • somacore
          New Member
          • Apr 2008
          • 24

          #5
          This is the code I'm using to trigger the combobox update.

          Code:
          private void comboBox55_SelectedIndexChanged(object sender, EventArgs e)
                  {
                      this.hD__Site_Name_DataTableAdapter.FillBySite(this.dataSet2.HD__Site_Name_Data, comboBox55.Text);
                      this.hD__Requestor_ProfileTableAdapter.FillByPerson(this.dataSet2.HD__Requestor_Profile, comboBox55.Text);
                  }
          Combobox55 clears after updating the other two boxes with the correct information.
          Last edited by somacore; Apr 4 '08, 03:08 PM. Reason: Add Information

          Comment

          Working...