Click to See Complete Forum and Search --> : Module Question
Steve Thomas
Nov 9th, 1999, 12:18 AM
I have a project with 3 forms. I can not figure out how to declare statements in one place that all 3 forms can use. Example: I have to place
Private Declare Function GetFocus& Lib "user32" ()
in all three forms in order to use this. I know there is a way to create one module and have all forms reference it? How
MartinLiss
Nov 9th, 1999, 12:57 AM
There are two things you can do. Change your declaration to Public and place it in any one of your forms' Declarations section, or
(better) add a module to your project and place the Public declaration there.
------------------
Marty
Frans C
Nov 9th, 1999, 12:58 AM
Select Project --> Add Module
from the menu and declare the function Public (instead of Private)
Joacim Andersson
Nov 9th, 1999, 01:01 AM
Add the declaration to a BAS module and declare it as Public instead of Private:
Public Declare Function GetFocusLib "user32" () As Long
Good luck!
------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)
QWERTY
Nov 9th, 1999, 01:43 AM
Marty you can't put Public Keyword in Form's Declarations Section. It causes an error!!!
------------------
Visual Basic Programmer (at least I want to be one)
------------------
PolComSoft
You will hear a lot about it.
Serge
Nov 9th, 1999, 01:48 AM
If you're declaring APIs or User Defined Data Types on the form level, then you must declare those as private only.
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
[This message has been edited by Serge (edited 11-09-1999).]
MartinLiss
Nov 9th, 1999, 01:51 AM
Actually you can.Public MyVariable As String
Public Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
The first statement is OK. The second one isn't.
------------------
Marty
QWERTY
Nov 9th, 1999, 01:53 AM
Sorry Martin, my mistake about variables.
------------------
Visual Basic Programmer (at least I want to be one)
------------------
PolComSoft
You will hear a lot about it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.