473,842 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Want to call DoEvents from library project

We've broken our app into various assemblies. The WinForm assembly provides
the user interface, other assemblies provide various I/O services. I'd like
to be able to call System.Windows. Forms.Applicati on.DoEvents from within a
dll, but it isn't allowed. I don't want to link the dll to our WinForm exe
which can call DoEvents.

Is there some way to call DoEvents from within a dll?

Thanks.
Nov 16 '05 #1
3 4795
dotNETDavid,

Why can't you call DoEvents? It is a public static method on the
Application object. You should have no problem calling it.

However, whether or not you SHOULD call it, that is a different story.
If you have a long running operation, then you should really spawn it off to
another thread, and eliminate the need to have DoEvents called. There
really is little reason to call DoEvents, ever. It's a hack for those that
don't use threads to perform long operations.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"dotNETDavi d" <do*********@di scussions.micro soft.com> wrote in message
news:5D******** *************** ***********@mic rosoft.com...
We've broken our app into various assemblies. The WinForm assembly
provides
the user interface, other assemblies provide various I/O services. I'd
like
to be able to call System.Windows. Forms.Applicati on.DoEvents from within a
dll, but it isn't allowed. I don't want to link the dll to our WinForm exe
which can call DoEvents.

Is there some way to call DoEvents from within a dll?

Thanks.

Nov 16 '05 #2
Nicholas:

Calling System.Windows. Forms.Applicati on.DoEvents(); gives the error:

<path>\Comm.cs( 354): The type or namespace name 'Windows' does not exist in
the class or namespace 'System' (are you missing an assembly reference?)

when I use it in a library project.

I'm using a serial port dll that does use threading. While waiting for input
from the port I'm in a loop where I'd like to call DoEvents to allow other
applications to have more timeslices.

Thanks for the help.

"Nicholas Paldino [.NET/C# MVP]" wrote:
dotNETDavid,

Why can't you call DoEvents? It is a public static method on the
Application object. You should have no problem calling it.

However, whether or not you SHOULD call it, that is a different story.
If you have a long running operation, then you should really spawn it off to
another thread, and eliminate the need to have DoEvents called. There
really is little reason to call DoEvents, ever. It's a hack for those that
don't use threads to perform long operations.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"dotNETDavi d" <do*********@di scussions.micro soft.com> wrote in message
news:5D******** *************** ***********@mic rosoft.com...
We've broken our app into various assemblies. The WinForm assembly
provides
the user interface, other assemblies provide various I/O services. I'd
like
to be able to call System.Windows. Forms.Applicati on.DoEvents from within a
dll, but it isn't allowed. I don't want to link the dll to our WinForm exe
which can call DoEvents.

Is there some way to call DoEvents from within a dll?

Thanks.


Nov 16 '05 #3
dotNETDavid,

In a library project, you have to add a reference to
System.Windows. Forms, and then add the using declaration for the namespace
System.Windows. Forms at the top of the file you want to use it in.

You can't be using threading if you are waiting on the UI thread.
Rather, you should spawn those functions out to another thread and have that
thread wait. If you run this in an environment that does not have access to
the UI, then the call to DoEvents might fail, and it would defeat the
purpose of having it in a separate library.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"dotNETDavi d" <do*********@di scussions.micro soft.com> wrote in message
news:3E******** *************** ***********@mic rosoft.com...
Nicholas:

Calling System.Windows. Forms.Applicati on.DoEvents(); gives the error:

<path>\Comm.cs( 354): The type or namespace name 'Windows' does not exist
in
the class or namespace 'System' (are you missing an assembly reference?)

when I use it in a library project.

I'm using a serial port dll that does use threading. While waiting for
input
from the port I'm in a loop where I'd like to call DoEvents to allow other
applications to have more timeslices.

Thanks for the help.

"Nicholas Paldino [.NET/C# MVP]" wrote:
dotNETDavid,

Why can't you call DoEvents? It is a public static method on the
Application object. You should have no problem calling it.

However, whether or not you SHOULD call it, that is a different
story.
If you have a long running operation, then you should really spawn it off
to
another thread, and eliminate the need to have DoEvents called. There
really is little reason to call DoEvents, ever. It's a hack for those
that
don't use threads to perform long operations.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"dotNETDavi d" <do*********@di scussions.micro soft.com> wrote in message
news:5D******** *************** ***********@mic rosoft.com...
> We've broken our app into various assemblies. The WinForm assembly
> provides
> the user interface, other assemblies provide various I/O services. I'd
> like
> to be able to call System.Windows. Forms.Applicati on.DoEvents from
> within a
> dll, but it isn't allowed. I don't want to link the dll to our WinForm
> exe
> which can call DoEvents.
>
> Is there some way to call DoEvents from within a dll?
>
> Thanks.


Nov 16 '05 #4

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

Similar topics

5
1922
by: Srinivas Kollipara | last post by:
Hey guys, In my project one place I am using Application.DoEvents() and waiting for 5 minutes to finish my required task in that block. My project need to run for almost 60 hours continuously to finish executing. this block which has Application.DoEvents will run for each 2 minutes. it ran well for 20 hours and I am getting an exception saying "Item has already been added. Key in dictionary: "-1" Key being added: "-1"" Can Anyone help...
1
3978
by: Abdalla Fawaz El-Hawary | last post by:
I have a solution includes 2 projects the 1st one is a class library project and the 2nd is windows application. Normally i can use the classes wich in the 1st project(DLL) after add refrence for this project at the windows application(2nd project) but the problem is i can't do the versa (how can i call any classes located in the windows application project from the DLL(1st project)... for example i need to call bank_win.Form1 class which...
3
985
by: Edward | last post by:
Hello, Win VB6 i used doevents() to update my forms during a process, but for whatever reason this is changed in vb.net. Can someone help me with how this should work. Thanks, Edward
1
6022
by: RSH | last post by:
I created a new Windows Form project and I created a simple richtextbox to write to and I am looping through a simple example but obviously the screen isn't updated it only shows the first occurance. I have used Application DoEvents in the past to update the screen which works. but for some reason in this project when i use Application.DoEvents i get the error... "DoEvents() Is not a member of DTS.Application" How do I make the...
4
1693
by: Tony Johansson | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. Here we have a class called B One project that build a class library dll. Here we have a class called C We have one dependency and that is from the user control to the class library because in the constructor for class B in the user control we have a call to
5
1949
by: Tony Johansson | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. Here we have a class called B One project that build a class library dll. Here we have a class called C We have one dependency and that is from the user control to the class library because in the constructor for class B in the user control we have a call to
1
13421
by: pcnerd | last post by:
I have VB.NET 2005 Express Edition. Is there a VB.NET equivalent to the "classic" VB's DoEvents? I searched the VB.NET Help & had no luck. In "classic" VB, DoEvents was used in code that might lock up the PC. Thank you. David
12
2306
by: Justin | last post by:
I can attach my code if anyone wants to see it however I'll try to ask my question with some mark up code first. I'm having a problem terminating my process while using DoEvents. For example: Button.text = start If button.text = start then button.text = stop
11
5183
by: Don | last post by:
I have a WPF application in VB in VSTS 2008 RTM. I am trying to "blink" (momentarily clear) a field of data if the data is reloaded from the database to give the user some visual indication of the LOAD operation. So on the LOAD button I clear the text fields, do mainCanvas.UpdateLayout( ), and the reload the text field from the database. But the text fields are not cleared long enough to see them blink.
0
9872
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
9715
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10945
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, 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...
0
10612
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...
0
10314
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5696
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
5885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4499
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
3145
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.