Click to See Complete Forum and Search --> : COMBO BOX PROBLEM..


May 17th, 1999, 02:30 AM
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 ...

Lothar Haensler
May 17th, 1999, 03:06 AM
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 ...

Ravi Kiran
May 20th, 1999, 01:02 AM
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