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

    Combo Box Click Event

    If I'm not wrong, combo box click event must only triggered when the user
    clicks on the combo box. But something unsual is happening with my code.

    combo box click:
    Private Sub cboTrack_Click()
    'do something here
    End Sub

    Private Sub Example()
    cboTrack.Text = cboTrack.List(0) '<========= 'I have a breakpoint
    here
    End Example

    Whenever the control is done with;
    cboTrack.Text = cboTrack.List(0) '<========= 'I have a breakpoint
    here
    it goes to combo box click event. But i haven't called it and have no
    intension of doing it either.
    Is there a way to stop VB to go to combo box click event ofcourse without
    deleting the event itself?

    Thanks,
    Simon



  2. #2
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: Combo Box Click Event

    That happens when the combo style is set to drop down list. You may need to put in a flag in the click event to process the following code or skip it.


    option explicit
    dim skipcombo as boolean

    private sub cboTrack_click()
    if skipcombo = true then 'skip the click event
    exit sub
    end if
    'process this event if skipcombo = false
    do something ...
    do something else ...
    end sub


    Private Sub Example()
    skipcombo = true
    cboTrack.Text = cboTrack.List(0) '<========= 'I have a breakpoint
    here
    skipcombo = false
    End sub




    David Paulson


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

Featured