Click here to Skip to main content
16,008,299 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: listbox code problem Pin
Colin Angus Mackay27-Nov-07 0:13
Colin Angus Mackay27-Nov-07 0:13 
Questionhi all Pin
poonams26-Nov-07 23:43
poonams26-Nov-07 23:43 
AnswerRe: hi all Pin
Colin Angus Mackay27-Nov-07 0:14
Colin Angus Mackay27-Nov-07 0:14 
QuestionMicrosoft Visual SourceSafe related issue. Pin
KETAN K.26-Nov-07 22:46
KETAN K.26-Nov-07 22:46 
AnswerRe: Microsoft Visual SourceSafe related issue. Pin
Dave Kreskowiak27-Nov-07 4:57
mveDave Kreskowiak27-Nov-07 4:57 
GeneralRe: Microsoft Visual SourceSafe related issue. Pin
KETAN K.28-Nov-07 1:28
KETAN K.28-Nov-07 1:28 
QuestionConfusion about the form_activate event Pin
nishkarsh_k26-Nov-07 22:12
nishkarsh_k26-Nov-07 22:12 
AnswerRe: Confusion about the form_activate event Pin
John_Adams27-Nov-07 0:01
John_Adams27-Nov-07 0:01 
Hi,

With reference to your query I would like to explain the sequence of Form based events:

INITIALIZE:

This event fires only when an application first creates an instance of a form. In an application with a startup form, the first event that occurs is the startup form's Initialize event. Initialize may also be called well in advance of a Load or Show if, for example, the following statement is executed:

Set x = New Form1


In addition, Initialize is called again if all of the references to the form have been previously set to Nothing and the form is then loaded, shown or has a variable set to it
(for example, Set x = New Form1).

Many of the tasks previously done in the Form_Load statement can, in Visual Basic 4.0, be performed in the Form_Initialize statement. Any statement that needs to be performed a single time when a form is created can be done here. Be careful that you do not reference any of the properties of the controls on the form because doing so will cause an automatic Form_Load.


LOAD:


The Form_Load event fires when a form is first loaded into memory. A form can be caused to load by an explicit Load statement, by calling a Show method when the form is not already loaded, or by a line of code in another module making a reference to any of the unloaded form's properties (or to any properties of the unloaded form's children).

For example, if Form2 is not loaded, and a subroutine in Form1 executes a line of code setting or reading Form2's Caption property, then Form2 will be loaded into memory, and the corresponding Form2_Load event will be called. Unless a form is loaded as a result of a Show method or has its Visible property set to True, the form will be loaded into memory but will not be made visible. Forms can be hidden and shown (using the Hide and Show methods) while remaining in memory; the Load event will only be fired when the form is first loaded.

Some procedures and methods of controls (for example, the SetFocus method) require that their parent form be loaded before they are called. In this situation, the best thing to do is to perform an explicit Form.Show in the Form_Load event, and do any such initialization after calling the Show method. This is preferable to doing the initialization in, for example, the Form_Activate event because Activate is called every time the user switches between forms in an application. Also, if you are calling related events, such as Activate, Paint, or Resize, be careful that their actions do not conflict with the Load and that they don't fire recursive events.

ACTIVATE:

As was stated previously, the Activate event is called every time a form becomes the active window, as long as the focus has moved between forms in the application. The Activate event is not called if the previous window that had the focus was outside of the application.

There are fewer caveats with Activate than with the previous two event procedures, perhaps because Activate is marginally less important than the Initialize and Load events. Code that needs to be executed every time the focus changes within an application should reside in the form's activate event.

I hope this helps.


Regards,
John Adams
ComponentOne LLC

GeneralRe: Confusion about the form_activate event Pin
nishkarsh_k27-Nov-07 20:42
nishkarsh_k27-Nov-07 20:42 
GeneralRe: Confusion about the form_activate event Pin
Dave Kreskowiak28-Nov-07 3:36
mveDave Kreskowiak28-Nov-07 3:36 
QuestionXML Encoding problem Pin
Benny_Lava26-Nov-07 21:05
Benny_Lava26-Nov-07 21:05 
AnswerRe: XML Encoding problem Pin
pmarfleet26-Nov-07 21:56
pmarfleet26-Nov-07 21:56 
QuestionArray Sort Pin
MrFulvio26-Nov-07 20:38
MrFulvio26-Nov-07 20:38 
AnswerRe: Array Sort Pin
Christian Graus26-Nov-07 21:07
protectorChristian Graus26-Nov-07 21:07 
AnswerRe: Array Sort Pin
nlarson1127-Nov-07 3:36
nlarson1127-Nov-07 3:36 
QuestionHow to use HTML file in VB.Net 2005 Pin
Sipder26-Nov-07 19:28
Sipder26-Nov-07 19:28 
AnswerRe: How to use HTML file in VB.Net 2005 Pin
pmarfleet26-Nov-07 21:54
pmarfleet26-Nov-07 21:54 
QuestionODBC connection and SQL 2000 Pin
Sipder26-Nov-07 19:23
Sipder26-Nov-07 19:23 
AnswerRe: ODBC connection and SQL 2000 Pin
pmarfleet26-Nov-07 21:52
pmarfleet26-Nov-07 21:52 
GeneralRe: ODBC connection and SQL 2000 Pin
Sipder27-Nov-07 22:52
Sipder27-Nov-07 22:52 
GeneralRe: ODBC connection and SQL 2000 Pin
pmarfleet27-Nov-07 23:34
pmarfleet27-Nov-07 23:34 
AnswerRe: ODBC connection and SQL 2000 Pin
Dave Kreskowiak27-Nov-07 4:51
mveDave Kreskowiak27-Nov-07 4:51 
GeneralRe: ODBC connection and SQL 2000 Pin
Sipder27-Nov-07 22:48
Sipder27-Nov-07 22:48 
GeneralRe: ODBC connection and SQL 2000 Pin
pmarfleet27-Nov-07 23:35
pmarfleet27-Nov-07 23:35 
GeneralRe: ODBC connection and SQL 2000 Pin
Sipder29-Nov-07 18:03
Sipder29-Nov-07 18:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.