CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Nothing in the combobox when firing the leave event

  1. #1
    Join Date
    Aug 2017
    Posts
    3

    Nothing in the combobox when firing the leave event

    I have a number of comboboxes that I use to capture user input. I am using the leave event to capture the user selection. If I use the mouse to move to the next combobox, I get a value. But if I use a tab to leave and enter the next combobox then I am not getting any value to evaluate. I can detect the value using combobox1.text to give me the entry but I am unable to add the value back into the combobox selection.

    Example one combobox:

    Code:
        Private Sub cmbT22tx_Leave(sender As Object, e As EventArgs) Handles cmbT22tx.Leave
            thisScore = Me.cmbT22tx.SelectedItem.ToString()
            myComment = ""
            If thisScore = "Fail- Self" Then
                myComment = currResources.T22C + "(Self)"
            End If
            If thisScore = "Fail- Company" Then
                myComment = currResources.T22C + "(Company)"
            End If
            If thisScore = "Fail- Incorrect brand" Then
                myComment = currResources.T22C + "(Incorrect brand)"
            End If
            If myComment <> "" Then
                rtbT1Notes.AppendText(myComment + vbNewLine)
            End If
        End Sub
    Any suggestions to force the combobox to respond with a value when I tab out of the control which most of user will do rather a mouse click.
    Last edited by 2kaud; August 29th, 2017 at 11:43 AM.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,358

    Re: Nothing in the combobox when firing the leave event

    What happens after the user leaves all the comboxes - is there something you do then?

  3. #3
    Join Date
    Aug 2017
    Posts
    3

    Re: Nothing in the combobox when firing the leave event

    Quote Originally Posted by Arjay View Post
    What happens after the user leaves all the comboxes - is there something you do then?
    No. Basically this one combobox is a set of 14 on a tab. Each box has to respond real time by loading the appropriate information (ie... selected.item) that post to another section of the form, firing additional events. I just need to know how to get the Selected.Item.ToString to have the selected value when the user tabs out of the combobox. I have tried a few things but no solution.

  4. #4
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,354

    Re: Nothing in the combobox when firing the leave event

    I generally use the selected item changed event
    Always use [code][/code] tags when posting code.

  5. #5
    Join Date
    Aug 2017
    Posts
    3

    Re: Nothing in the combobox when firing the leave event

    Quote Originally Posted by DataMiser View Post
    I generally use the selected item changed event

    I have tried all the selected.* events without success. I am working with the 2 step validation process and that seems to capture the selection. I will use appropriate [code] tags from here out. Sorry the mess, old programmer but first post to a forum..lol

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: Nothing in the combobox when firing the leave event

    I prefer the DropdownClosed event nowadays
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)