473,385 Members | 1,855 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,385 software developers and data experts.

Form Load Event

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).

'Do something in code

frm.ShowDialog (The Form Load Event fires again)

Shouldn't the Form Load event fire only once when the form is first shown
and not again unless I do a form.close first?
......
--
Dennis in Houston
Nov 21 '05 #1
3 2700
"Dennis" <De****@discussions.microsoft.com> schrieb:
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).

'Do something in code

frm.ShowDialog (The Form Load Event fires again)

Shouldn't the Form Load event fire only once when the form is first shown
and not again unless I do a form.close first?


'Load' will be raised prior to showing the form, so it can be raised more
than once. If code should only be executed on time for each form instance,
add the code in the form's constructor directly 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 #2
If the load event is going to be fired each time I show the form, then what's
the difference between the Load Event and the Activated EVent...they both
seem to fire whenever I show the form? Thanks for help Herfried!

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@discussions.microsoft.com> schrieb:
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).

'Do something in code

frm.ShowDialog (The Form Load Event fires again)

Shouldn't the Form Load event fire only once when the form is first shown
and not again unless I do a form.close first?


'Load' will be raised prior to showing the form, so it can be raised more
than once. If code should only be executed on time for each form instance,
add the code in the form's constructor directly 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
"Dennis" <De****@discussions.microsoft.com> schrieb:
If the load event is going to be fired each time I show the form, then
what's
the difference between the Load Event and the Activated EVent...they both
seem to fire whenever I show the form? Thanks for help Herfried!


The 'Activated' event will fire too then the form looses focus and is
reactivated later.

--
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

5
by: David Smith | last post by:
Under a certain circumstance, I want a form to display a messagebox in the load event, and then close. But apparently I cant close a form in the load event. Any ideas? Thanks
8
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender,...
0
by: Frank 'Olorin' Rizzi | last post by:
Hello everyone. This is quite convoluted, but I'll try to make it simple. I have a couple of bottom-line questions (I guess): 1~ what happens between the Page_Load routine in the code behind...
2
by: Giovanni Bassi | last post by:
Hello All, I have encountered a problem. I am using visual inheritance and my base form adds an event handler on Form Load using the AddHandler Keyword. The problem is that if the Event...
10
by: Chad Miller | last post by:
I currently have a base form that I inherit. The base for has a custom event. The event will not raise threw the inherited form. I was wondering if events work threw inheritance or should I use...
5
by: Engineerik | last post by:
I have a login form which I want to display with the showdialog method. When I do that the event handler for the load event does not run. If I use the show method the load event handler runs...
2
by: **Developer** | last post by:
I have a little more info about this problem I can't seem to solve! I know it'll take a minute to study the lising but if you like to sove puzzles there is one there. I have a Form (FV&C)...
6
by: tony | last post by:
Hello! When exactly is it important or advisable to use this form load event handler compare to using the C-tor. For example here I create an event handler called dataBoundGridForm that is...
10
by: sara | last post by:
Hi - I have been struggling with solution ideas for this now for almost 2 weeks, and have not been able to figure this out. I have a user who creates a Purchase Order (tblPOData). In some...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.