|
-
Nov 9th, 1999, 01:18 AM
#1
Thread Starter
Addicted Member
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
-
Nov 9th, 1999, 01:57 AM
#2
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
-
Nov 9th, 1999, 01:58 AM
#3
Select Project --> Add Module
from the menu and declare the function Public (instead of Private)
-
Nov 9th, 1999, 02:01 AM
#4
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
[email protected]
[email protected]
www.YellowBlazer.com
-
Nov 9th, 1999, 02:43 AM
#5
Fanatic Member
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.
-
Nov 9th, 1999, 02:48 AM
#6
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
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 11-09-1999).]
-
Nov 9th, 1999, 02:51 AM
#7
Actually you can.
Code:
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
-
Nov 9th, 1999, 02:53 AM
#8
Fanatic Member
Sorry Martin, my mistake about variables.
------------------
Visual Basic Programmer (at least I want to be one)
------------------
PolComSoft
You will hear a lot about it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|