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

    COMBO BOX PROBLEM..

    Hi.. Please let me know...
    recursion click event in the combo box
    when i access to the combo box's Text ...
    How do i remove the recursion event from combo box...
    Please ...


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: COMBO BOX PROBLEM..

    there is no such thing as a "recursion event" for the combobox, but you can implicitly create a recursive loop by setting the text property of a combobox control upon receipt of the Change Event, because setting the Text property will cause a change event ...


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

    Re: COMBO BOX PROBLEM..

    Hi,
    Actually, the recursive events triger not when you "access to the combo box's Text ", but when you change it.
    VB is designed to fire this kind of recursive events. Onlyway is to use a local variable/flag and exit the function when true: Something like this:
    In Declaration Section:


    private m_dontcallclick as boolean
    private sub Combo1_Click()
    if m_dontcallclick then exit sub ' check for flag
    ' else is implied..
    ' Change the selected index, so that another
    'click event is trigered in recursion
    'if combo1.listindex <> 0 then combo1.listindex = 0
    '
    ' If you dont want the recursion use like this:
    if combo1.listindex <> 0 then
    m_dontcallclick = true
    combo1.Listindex = 0
    m_DontcallClick = false ''<<-- MOST IMP.
    end if
    ' compare this with the commented line above

    end sub





    If you have 'heavy' processing on click, preferable to write a function for it, and call/dontcall it depending on the flag.

    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