Q: fire doubleclick event in code?

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
 
D

Dirk Goldgar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top