473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Form Load vs Activated Event

I thought that the Load Event fired first and the Activated event fired next
when a control is shown. For example

Dim myForm as New Form1

myForm.Show

I put a breakpoint in the load event and one in the activated event and the
activated event fires first. I am trying to implement adding an event
handler in the load event for the activated event then removing the handler
in the activated event such that the activated event only fires once.

Am I wrong in the event firing sequences?

--
Dennis in Houston
Nov 21 '05 #1
3 3960
Dennis,

Am I wrong in the event firing sequences?

There are different sequences for different situations.

There is a page on MSDN which describes it, however it is for me as some
other obvious pages as about the methods in the microsoft namespace almost
impossible to find direct. Maybe can you try it yourself.

Cor

Nov 21 '05 #2
"Dennis" <De****@discussions.microsoft.com> schrieb:
I thought that the Load Event fired first and the Activated event fired
next
when a control is shown. For example

Dim myForm as New Form1

myForm.Show

I put a breakpoint in the load event and one in the activated event and
the
activated event fires first. I am trying to implement adding an event
handler in the load event for the activated event then removing the
handler
in the activated event such that the activated event only fires once.


You may want to add the handler in the form's constructor after the call to
'InitializeComponent'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
I could do that but I want to initialize some things in the Activated method
like setting a combobox.selectedindex to a value but I get an error because
the load event hasn't executed, the combobox is unavailable.
--
Dennis in Houston
"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
I thought that the Load Event fired first and the Activated event fired
next
when a control is shown. For example

Dim myForm as New Form1

myForm.Show

I put a breakpoint in the load event and one in the activated event and
the
activated event fires first. I am trying to implement adding an event
handler in the load event for the activated event then removing the
handler
in the activated event such that the activated event only fires once.


You may want to add the handler in the form's constructor after the call to
'InitializeComponent'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Randy | last post by:
Hello all, I have a form with a text field (textBox1) on it. Apparently, textBox1.Focus() doesn't work when the form is initializing. I put this in the Constructor and also in the Load event for...
1
by: Kevin Carter | last post by:
Hi there...hoping somebody can help me out because I am almost ready to pull out my hair. My problem is as follows: In a method in my main form (non MDI app), I instantiate and .Show another...
4
by: Grant Schenck | last post by:
I have a C# form application. Once my main window is showing I want to pop-up a login type dialog. What event would I trap to affect this? I tried handling the form load but the main form window...
6
by: nadeem_far | last post by:
Hello All, I am working on a .Net desktop application and I am having problem displaying a form. I am using C# and version 1.1 of the framework. here is how the code looks likes and I will...
3
by: Cc | last post by:
does event onload mean form already loaded or before loaded? I make a form and I inherit that form on another form, when I run, it execute the process on the parent form without showing the form on...
10
by: B-Dog | last post by:
I want to run something once my form in completely loaded and drawn but running at the end of form load doesn't do I guess cause of the large dataset fill and the form isn't fully loaded. Where...
3
by: Dennis | last post by:
I have the following code for showing a form: dim frm as new myForm frm.ShowDialog (The Form Load Event is fired then I hide the form using Me.Hide when the X in the UR corner is clicked). ...
6
by: traversd | last post by:
Hi there, this is driving me nuts! i have a program that is to be run over night, no interaction from the user. I want the code to start runing when the program is started, but i also want to...
2
by: thomasp | last post by:
Using VB 2005 Beta. I have a form containing a DataGirdView. The cell enter, cell validating, row enter, row validating events have a good bit of code that gets excuted for each of these...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.