I've noticed that calling DoEvents is much slower in an application that has called Application.Ena bleVisualStyles in Sub Main. Furthermore, the performance seems to worsen each time that DoEvents is called.
To demonstrate what I'm experiencing, create an app with a Sub Main, a Main Form, and a Button (called Button1). Include the following code in Sub Main:
Application.Ena bleVisualStyles
Application.DoE vents
Application.Run (New MainForm)
Now, include the following code in the Click event handler of Button1:
For i As Integer = 1 to 8000
Application.DoE vents
Next i
On my system the first time that I click Button1 takes ~0.92 seconds. Subsequent clicks take 1.35, 1.73, 2.12, and 2.52 seconds. But, if I now remove Application.Ena bleVisualStyles from Sub Main, then clicking Button1 only takes ~0.07 seconds (and the time does not increase if I continue to click Button1).
Is this a known issue? Is there a fix? Would it help to enable visual styles via a manifest file rather than calling EnableVisualSty les?
I'm using .NET Framework v1.1 on Windows XP Pro (SP1).
Thanks,
Lance
Nov 20 '05
17 2400
Lance, I thought that this technique was faily common. Am I wrong?
Its fairly common in VB6. However! you are in VB.NET now! ;-)
Is there a better way?
In VB.NET I would use a Thread or the Application.Idl e event to run the long
process. (I would favor a Thread over Application.Idl e, mostly becuase a
Thread is easier). http://msdn.microsoft.com/library/de...dComponent.asp
Review that entire section of MSDN.
Hope this helps
Jay
"Lance" <zi***@hotmail. com> wrote in message
news:36******** *************** ***********@mic rosoft.com... Thanks for the example!
The reason for my interest is when DoEvents is called from within a long
loop in order for an app to respond to the user while the loop is executing.
I thought that this technique was faily common. Am I wrong? Is there a
better way? If not, then it seems to me that in this case having DoEvents
take 13+ times longer can be an issue, depending on the size and structure
of the loops. Thanks again, Lance
For those of you looking at Whidbey (VS.NET 2004), I found this class which
should simplify adding Threading to a Windows Forms application! http://longhorn.msdn.microsoft.com/l...undworker.aspx
Jay
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:eP******** ******@TK2MSFTN GP11.phx.gbl... Lance, I thought that this technique was faily common. Am I wrong? Its fairly common in VB6. However! you are in VB.NET now! ;-)
Is there a better way? In VB.NET I would use a Thread or the Application.Idl e event to run the
long process. (I would favor a Thread over Application.Idl e, mostly becuase a Thread is easier).
http://msdn.microsoft.com/library/de...dComponent.asp Review that entire section of MSDN.
Hope this helps Jay
"Lance" <zi***@hotmail. com> wrote in message news:36******** *************** ***********@mic rosoft.com... Thanks for the example!
The reason for my interest is when DoEvents is called from within a long loop in order for an app to respond to the user while the loop is
executing. I thought that this technique was faily common. Am I wrong? Is there a better way? If not, then it seems to me that in this case having DoEvents take 13+ times longer can be an issue, depending on the size and structure of the loops. Thanks again, Lance
Hi Lance,
Thanks for your quickly reply!
I can reproduce the behavior. Also I have reported it to our product group,
I will get back with more information here ASAP.
Thank you for your understanding.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Wow! BackgroundWorke r looks awesome! Now you really have to tell me how to get Whidbey :)
Lance,
Call MSDN customer support and ask for it. http://msdn.microsoft.com/Longhorn/S...ng_GetLonghorn
Of course this means that you need to an MSDN subscriber.
Note the PDC version of Whidbey is an alpha/Technology Preview version. I
have not seen anything on getting on the Whidbey Beta yet.
Hope this helps
Jay
"Lance" <zi***@hotmail. com> wrote in message
news:01******** *************** ***********@mic rosoft.com... Wow! BackgroundWorke r looks awesome! Now you really have to tell me how
to get Whidbey :).
Thanks a lot for the info! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sylvain Barde |
last post by:
When I use Application.EnableVisualStyles()
Public Sub New()
MyBase.New()
Application.EnableVisualStyles()
Application.DoEvents()
|
by: #ROBERT |
last post by:
(VS 2003 + .NET Framework 1.1 + WinXP Pro SP2)
Calling Application.EnableVisualStyles() after the initialization() removes
all images in the tab control (in the tab headers I mean). Without visual
styles enabled, I have no
problem. What is wrong and what is the solution?
(PS: Using a manifest file makes no trouble. just the function :
Application.EnableVisualStyles() )
Thanks for any help.
|
by: desa |
last post by:
If I call EnableVisualStyles none the images in my ImageLists show up in my
controls anymore.
Is this a known issue? How do I fix this? I'm using VS.NET 2003.
|
by: mphanke |
last post by:
Hi,
everytime I enable the Visualstyles on in my app it keeps crashing at a
point, where I close my progress window with progressdialog.close(). It
runs in a seperate thread and contains a timer and a progressbar- if
this is of interest.
Best regards,
Martin
|
by: Christian Westerlund |
last post by:
Hi!
I usually enable visual styles in my apps. I do it in Main before I
start my app with Application.Run.
Today when I changed from debug to release mode in Visual Studio .NET
2003, the XP-style disappeared when I ran the app.
I changed back to debug mode but I couldn't get the more appealing
XP-style back.
I even created a new solution and projects and manually copied my files
| |
by: Juan Pedro Gonzalez |
last post by:
I am a bit unsure about this "Effect"... My code:
Public Sub Main()
Application.EnableVisualStyles()
Application.DoEvents()
Dim myMainForm As New FormularioPrincipal
Dim mySplash As New MyClass.SplashScreen
If mySplash.ShowDialog() = DialogResult.OK Then
|
by: Michael A. Covington |
last post by:
I added Application.EnableVisualStyles() as the first statement in Main() of
my program, and didn't notice much change in visual appearance, but what I
*did* notice is that some of my buttons stopped working! They were enabled
but no longer called their OnClick methods.
I tried adding Application.DoEvents() right after EnableVisualStyles and
that didn't help.
What gives? In VS 2005/.NET 2.0, is EnableVisualStyles broken? This is...
|
by: Michael A. Covington |
last post by:
Further to previous post...
I have a big, complex program which works fine as long as I don't call
EnableVisualStyles.
If I do this:
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new FormOpeningMenu());
|
by: Peter |
last post by:
Hello,
I'm using Visual Studio 2003 and it would be nice if my buttons and other
controls could look like Windows XP buttons rather than the flat square
kind. I looked on the web and found some info on
Application.EnableVisualStyles, but I'm not seeing much indication that 2003
supports it. Does it? And if so, how does it work?
|
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...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |