UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
July
Su M Tu W Th F Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Our Sponsors
Latest Postings
Comcast upgrades Upload Speed!
by Gizmo
Today at 04:00 PM
Robert Moore aka MooreR PC Magazine Subscription
by Gizmo
06/22/08 01:36 PM
How to write a GUI with C++ in windows?
by Murakami Kakason
06/18/08 06:21 AM
Podcasting, ideas and interests...
by ZER0_DECEPTION
06/16/08 07:43 AM
PHP -MVC(Model, View, Control) overview
by §intå×
06/09/08 05:07 AM
Vote for President
by ZER0_DECEPTION
06/06/08 07:46 AM
Notepad++ 4.9.2 - open source text editor
by Gizmo
06/06/08 01:42 AM
Topic Options
#17515 - 12/23/03 05:25 AM Urgent! Any expert, please help - reference to other form!
AskProf Offline
Junior Member

Registered: 12/23/03
Posts: 2
Hello, All:

Recently I have been annoyed by the following question very much. It will be highly appreciated if anyone could help me!

I want to refer to some properties or controls in another form while I don't want to declare too much public variables.

For example, in module1, I want to get hwnd of frmMain:

hwnd = frmMain.hwnd

Here is my question:

When call the properties or control outside a form through the form name,

1. the event Form_Load (or Form_Initialize) will also be triggered in some projects;
2. while in some other projects, Form_Load (or Form_Initialize) will not be triggered and I can call it just as a variable.

In which cases Form_Load will be triggered and in which not?

Please help me!!! Thank you very much!

Top
Our Sponsors
Sponsor Our Sponsors

Top  
#17516 - 12/23/03 08:42 AM Re: Urgent! Any expert, please help - reference to other form!
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: OH, USA
When calling a public variable or property of a unloaded form:

1) That form's Form_Load event is called
2) The public variable or property is accessed

In that order. This always happens - and the form is not displayed. It won't be displayed until you call the form's show event or set the visible property to true. It is impossible to call those members of the form without first loading it.

Modules are the preferred choice. Modules are loaded when they are accessed and they stay loaded for the rest of that program's execution.
_________________________
Domain Registration, Hosting, Management
http://www.dollardns.net

Top
#17517 - 12/23/03 09:54 AM Re: Urgent! Any expert, please help - reference to other form!
AskProf Offline
Junior Member

Registered: 12/23/03
Posts: 2
Hello, SilentRage:

Thank you very much!

But the case I encountered is that:

'frmMain' has finished loading. In the course of running, I need to call another procedure and in this procedure I will access some properties of frmMain. 'frmMain' remains displayed and loaded. Anyway the Form_Load in frmMain is triggered again (but in some other similar projects will not).

Top
#17518 - 12/28/03 05:09 AM Re: Urgent! Any expert, please help - reference to other form!
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: OH, USA
Form_Load will only be triggered multiple times if they are explicitly called in the code, or if you are loading duplicate forms like if you declare a variable as that form and play with it, or if the form is unloaded at any point (user presses the 'X' or the Unload method is called on it).
_________________________
Domain Registration, Hosting, Management
http://www.dollardns.net

Top



Forum Stats
6899 Members
45 Forums
10167 Topics
44858 Posts

Max Online: 677 @ 06/30/07 10:06 PM
Top Posters
Gizmo 6894
§intå× 3241
UGN Security 3113
IceMyst 1445
SilentRage 1273
Ice 1146
pergesu 1134
Infinite 1039
jonconley 954
Girlie 903
Newest Members
real-along, Murakami Kakason, die, ReduX, UknownWarrior
6898 Registered Users
Who's Online
0 Registered (), 9 Guests and 19 Spiders online.
Key: Admin, Global Mod, Mod
Latest News
IRC Server Funding
by Gizmo
07/01/08 02:48 PM
Fixed: Front Page - News Display
by Gizmo
06/25/08 11:25 AM


Donate

Get the Google FireFox Toolbar
Get Firefox!
Get FireFox!