CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 1999
    Posts
    20

    Avoiding click event ....



    Hi Friends,


    I am using a combobox, inwhich I filled out items. At the end when I set the listindex property of combo, automatically CLICK event is get fired. So my question is How I can avoid the click event to get fired, if I don't want for some time....


    Thanx...


    Anand...

  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Avoiding click event ....





    Hi,


    I guess there is no way you can stop the click event from firing when you set listindex of a combobox. Only way is a work around.

    Have a boolean member variable , something like m_bDontProcessClick


    Just before you set the value of list index, set this flag to true : Like

    m_bDontProcessClick = true

    cmbMyCombo.ListIndex = i

    m_bDontProcessClick = False ' <<-- Important LINE!


    and in the click event, check for this flag and exit if true.

    private sub cmbMyCombo_Click

    if m_bDontProcessClick then exit sub

    .... rest of the normal processing follows..

    end sub


    Be sure to reset the flag, otherwise your legitimate clicks also will not be processed!


    Ravi



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