My Assistant
![]() ![]() |
|
|
Sep 15 2005, 03:24 AM
Post
#1
|
|
|
New Member Posts: 1 |
Hi Guys
I'm a bit of a novice with VBA (I'm much more used to C++/MFC); I've managed so far, but seem to have got a bit stuck with this: I've got two controls on a form - ListBoxA and ButtonB. All I want to do is to cause the OnClick event of ButtonB to call the OnDoubleClick code of ListBoxA, assuming that the selection in the list box has already been made validly. Mainly so I don't have to put the same code chunk in twice... It sounds so simple. Here are the main two things I've tried: |Private Sub ButtonB_Click () | | Me.ListBoxA.OnDblClick ' => runtime errors about incorrect use of the OnDblClick property. | Gosub List17_DblClick ' => Complains that 'List17_DblClick' is an undefined identifier or something | |End Sub Can some kind person put me out of my misery? Cheers Alsitair |
|
|
|
Sep 15 2005, 03:32 AM
Post
#2
|
|
|
UtterAccess Ruler Posts: 2,196 From: Den Bosch - Netherlands |
I believe this would do the trick:
Call ButtonB_Click () |
|
|
|
Sep 15 2005, 06:29 AM
Post
#3
|
|
|
UtterAccess Veteran Posts: 458 From: austria, lake constance |
Or change to event to Public and call it
|Public Sub ButtonB_Click () | | |End Sub call it Me.ButtonB_Click() |
|
|
|
Sep 15 2005, 09:36 AM
Post
#4
|
|
|
UtterAccess Addict Posts: 207 From: Atlantic City, NJ |
Try this
Call ListBoxA_DblClick |
|
|
|
Sep 15 2005, 09:40 AM
Post
#5
|
|
|
UtterAccess Addict Posts: 207 From: Atlantic City, NJ |
Sorry I think I made a slight mistake.
The double click eveny requires a "Cancel" parameter. Try This Call ListBoxA_DblClick(False) |
|
|
|
Sep 15 2005, 09:58 AM
Post
#6
|
|
|
UtterAccess Addict Posts: 218 From: Stowe, Vermont |
You could try and throw the code from the double click event into a function in a module and just call the function from the double click event and the onclick event. This way you only have one fuction to deal with and any form can use it.
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 22nd May 2013 - 03:43 PM |