Results 1 to 7 of 7

Thread: Combobox clears itself

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    297

    Question Combobox clears itself

    What the!...

    First of all I tried to detect in Private Sub Combo1_Change()
    the difference between Combo1.listindex = -1 and higher (selected in the dropdownbox), but it didn't work in VB.NET.
    (In VBA it works perfectly!)

    So I tried it differently:
    I've made parallel to the change sub an 'click sub' to detect
    the clicking in the dropbox.
    If I fill my combobox and click in de dropdownbox,
    then the combobox.text clears itself!

    Does anyone know how to code the detection of changing the combobox through writing and change by selecting something in the dropbox?

    Please help, I'v tried to much...

  2. #2
    Member
    Join Date
    Aug 2003
    Posts
    38
    UR problem is not corectly displayed
    put ur code and ask ur problem

  3. #3
    Member Siu Yan's Avatar
    Join Date
    Apr 2004
    Location
    Hong Kong --> Ireland
    Posts
    49
    Have you tried the "SelectedIndexChanged" Event?
    I used this when I was programming with C#. Every times when you select the combobox, it fires this event.
    Quitters never Win, Winners never Quit, But those who Never Win and Never Quit are Idiots

  4. #4
    Member Siu Yan's Avatar
    Join Date
    Apr 2004
    Location
    Hong Kong --> Ireland
    Posts
    49
    I don't know will it help....
    Quitters never Win, Winners never Quit, But those who Never Win and Never Quit are Idiots

  5. #5
    Member Siu Yan's Avatar
    Join Date
    Apr 2004
    Location
    Hong Kong --> Ireland
    Posts
    49
    I don't know will this help. I searched from http://www.msdn.com

    You can change the showSelectedButton_Click event into Combo1_SelectedIndexChanged event and try the following

    VB Code:
    1. Private Sub showSelectedButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    2.     Dim selectedIndex As Integer
    3.     selectedIndex = comboBox1.SelectedIndex
    4.     Dim selectedItem As Object
    5.     selectedItem = comboBox1.SelectedItem
    6.  
    7.     MessageBox.Show("Selected Item Text: " & selectedItem.ToString() & Microsoft.VisualBasic.Constants.vbCrLf & _
    8.                         "Index: " & selectedIndex.ToString())
    9. End Sub
    Quitters never Win, Winners never Quit, But those who Never Win and Never Quit are Idiots

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    297

    Thanks for the suply, I'll try if it works

    Thanks, I'll try it!
    (The code is to long to display. in short the problem occurs after the click function has ended. With F8 during the walkthrough everything looks normal en what's selected is displayed in de combobox, but with 'end sub' it's gone. But I will try SelectedIndexChanged)

  7. #7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width