Q: fire doubleclick event in code?

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi all,

How do I use code to programmatically select an item in a listbox and fire
the doubleclick event for that listbox? I would be calling the event from a
function in a module outside of the form.

Thanks!
-Mark
 
Mark said:
Hi all,

How do I use code to programmatically select an item in a listbox and fire
the doubleclick event for that listbox? I would be calling the event from
a
function in a module outside of the form.


You can't actually make the event fire, but you can call the event procedure
directly -- IF you have changed the declaration of that event procedure from
Private to Public. For example, where the original event porcedure header
might have been like this:

Private Sub lstYourListbox_DblClick(Cancel As Integer)

You would change it to be like this:

Public Sub lstYourListbox_DblClick(Cancel As Integer)

Then you module could set the list box and call the procedure like this:

With Forms!frmYourForm
!lstYourListbox = 123
Call .lstYourListbox_DblClick(False)
End With
 
Back
Top