473,799 Members | 3,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How delay firing again

I had it happen again today that I needed some code to run upon loading the
form but the code that I needed to have run needed to run AFTER all the rest
of Visual Studio's events had fired. Due to the fact that the Visual Studio
events continued to fire after I ran my code, it goofed things up. Isn't
there any way to fix it so that the code you want to run upon startup of a
form is insured to run only after VS has fired all it's events?

Nov 21 '05 #1
4 1179
Woody,

What event handler do you currently have your code in, and what events are
firing after that eventhandler runs?

Kerry Moorman
"Woody Splawn" wrote:
I had it happen again today that I needed some code to run upon loading the
form but the code that I needed to have run needed to run AFTER all the rest
of Visual Studio's events had fired. Due to the fact that the Visual Studio
events continued to fire after I ran my code, it goofed things up. Isn't
there any way to fix it so that the code you want to run upon startup of a
form is insured to run only after VS has fired all it's events?


Nov 21 '05 #2
What event is firing after your code? How does Visual Studio doesn't fire
events. If you just run the exe created Visual Studio isn't involved
anymore. I think your talking about the framework firing event, in which
case we need to know what is happening to mess you up. More info please.

Chris
"Woody Splawn" <No**********@j ts.bz> wrote in message
news:e2******** ******@TK2MSFTN GP09.phx.gbl...
I had it happen again today that I needed some code to run upon loading the
form but the code that I needed to have run needed to run AFTER all the
rest
of Visual Studio's events had fired. Due to the fact that the Visual
Studio
events continued to fire after I ran my code, it goofed things up. Isn't
there any way to fix it so that the code you want to run upon startup of a
form is insured to run only after VS has fired all it's events?


Nov 21 '05 #3
If I understand your problem correctly, the fix is pretty simple.

Create a class level boolean variable in your form class.

Private m_IsLoading as boolean=true

Add this line as the first line inside your events that you don't want to
run while VS is initiailizing the form at startup.

Public Sub SomeEvent(s as sender, e as eventargs) handles blah.blah
If m_IsLoading = True Then Return
' rest of event code here...
End Sub

Then in your Form Load event set m_IsLoading=fal se.

This solved a lot of issues I had like this.

HTH,
Greg
"Woody Splawn" <No**********@j ts.bz> wrote in message
news:e2******** ******@TK2MSFTN GP09.phx.gbl...
I had it happen again today that I needed some code to run upon loading the
form but the code that I needed to have run needed to run AFTER all the
rest
of Visual Studio's events had fired. Due to the fact that the Visual
Studio
events continued to fire after I ran my code, it goofed things up. Isn't
there any way to fix it so that the code you want to run upon startup of a
form is insured to run only after VS has fired all it's events?


Nov 21 '05 #4
Woody Splawn wrote...
I had it happen again today that I needed some code to run upon loading the
form but the code that I needed to have run needed to run AFTER all the rest
of Visual Studio's events had fired. Due to the fact that the Visual Studio
events continued to fire after I ran my code, it goofed things up. Isn't
there any way to fix it so that the code you want to run upon startup of a
form is insured to run only after VS has fired all it's events?


Sorry for the C# code but it is all I have:

private void OnAfterLoad()
{
// do stuff here you want done after form loads
}

private void ProgressDialog_ Load(object sender, System.EventArg s e)
{
// form load code goes here
BeginInvoke(new MethodInvoker(O nAfterLoad));
label2.Text = "Finished loading form";
}
Nov 21 '05 #5

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

Similar topics

7
3388
by: yoyo | last post by:
Is there anyway to delay a trigger from firing for a few seconds? I have an after insert trigger on table1, which selects information from table2 and table3. Obviously it cannot fire unless the required rows in table2 and 3 are filled out first. I can't just put the trigger on table2 or 3, because the order of insert there is different, depending on how the applicaiton is used, plus it would make for a very complicated trigger goig that...
3
5610
by: ELO | last post by:
Hi all Every week, I need to get two files on a remote server. I have developped a C# Windows Service with two System.Threading.Timer to do this task For the first one, the delay (TimeSpan dueTime) is always set to 6 days, 23 hours, 59 minutes, .. Some weeks ?!?, the timer restarts immediately after its execution (and loop indefinitely). I have made a lot of tests and this issue does not occur with a delay < 1 day .. Any suggestion
5
2807
by: Steve M | last post by:
Why are my sessions lasting so long? I have them set to 20 minute timeout in config file? The Session_End event is getting called an hour or more sometimes--well after the user has stopped interacting with my site. Anyone have any insight? Thanks in advance
18
3270
by: Max | last post by:
This is a follow-up on my previous thread concerning having the program wait for a certain date and time and then executing some code when it gets there. My question is; can I use the Sleep function from kernel32 to accomplish this? My concern is that this function takes milliseconds where my program needs to be accurate to within 5 minuets, and delays may be as long as a number of days, months or whatever. Would I run into many problems...
6
1869
by: Woody Splawn | last post by:
Is there a way in vb.net to delay the firing of certain code till after everything else has run? That is, I have an event with some code in it that needs to run AFTER everything else has run when the form is loaded. Is there a mechanism in vb.net that will allow the call of an event only after everthing else has fired and run?
14
4677
by: Rene Grothmann | last post by:
I have managed to communicate between forms and Java applets. A button press sends the content of the text area to an applet, a second button gets some text from the applet and puts it into the textarea. However, at the start, there is a delay of several seconds, before any of the buttons react to a click. After the first reaction has happened, all further clicks work immediately. Is this meant to be so, or can I speed up the first...
19
10216
by: furiousmojo | last post by:
This is a strange problem. I have a project where the contents of global.asax application_error are not firing. It is an asp.net 2.0 application using web application projects. I have another app using web application projects and it's firing fine but it was upgraded from the 1.1 framework. Why doesn't my global.asax application_error routine fire?
2
1900
by: Umeshnath | last post by:
Hi, I have a web application that refreshes a label control every 1 sec (interval set by timer control). I am using Atlas panel for refreshing. Basically I have a method say PollMSMQ(), which polls MSMQ after every 1 sec & display the message in the label, if any. In the same ASPX page I have button (Save Data). Problem is that, when my application thread enters to the method PollMSMQ(), it takes some time to poll the message queue say 3...
3
2716
by: =?Utf-8?B?Um9iZXJ0IFNsYW5leQ==?= | last post by:
I have a state transition trigger by a Delay Activity. If I include the default SQL persistence service, this state transition is fired twice. Any suggestions ?
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10228
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.