473,756 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cant use DoEvents in WPF application

Don
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.Upda teLayout( ), and the reload the text field from the
database. But the text fields are not cleared long enough to see them
blink.

So I add a Thread.Sleep(20 0) before reloading the text fields. Still
no visual blink.

So I change the Sleep(200) to Sleep(2000), Still no visual blink.

So I attempt to add an Application.DoE vents so that the application
gets a chance to repaint the screen. But when I attempt to add the
"Imports System.Windows. Forms" for the DoEvents, the IDE says
"System.Windows .Forms doesn't contain any public member(s) or cannot
be found."

Apparently DoEvents can not be used in a WPF application because it is
not a Windows Forms.

OK, so how do I get WPF to visually "blink" some text fields in
response to a button push?
How do I replace the DoEvents functionality in a WPF application?
Mar 18 '08 #1
11 5175
On 2008-03-18, Don <db*******@gmai l.comwrote:
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.Upda teLayout( ), and the reload the text field from the
database. But the text fields are not cleared long enough to see them
blink.

So I add a Thread.Sleep(20 0) before reloading the text fields. Still
no visual blink.

So I change the Sleep(200) to Sleep(2000), Still no visual blink.

So I attempt to add an Application.DoE vents so that the application
gets a chance to repaint the screen. But when I attempt to add the
"Imports System.Windows. Forms" for the DoEvents, the IDE says
"System.Windows .Forms doesn't contain any public member(s) or cannot
be found."

Apparently DoEvents can not be used in a WPF application because it is
not a Windows Forms.

OK, so how do I get WPF to visually "blink" some text fields in
response to a button push?
How do I replace the DoEvents functionality in a WPF application?
Are you referencing System.Windows. Forms.dll?

--
Tom Shelton
Mar 18 '08 #2
Don
On Mar 18, 12:16*pm, Tom Shelton
<tom_shel...@YO UKNOWTHEDRILLco mcast.netwrote:
On 2008-03-18, Don <dbaech...@gmai l.comwrote:


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.Upda teLayout( ), and the reload the text field from the
database. But the text fields are not cleared long enough to see them
blink.
So I add a Thread.Sleep(20 0) before reloading the text fields. Still
no visual blink.
So I change the Sleep(200) to Sleep(2000), Still no visual blink.
So I attempt to add an Application.DoE vents so that the application
gets a chance to repaint the screen. But when I attempt to add the
"Imports System.Windows. Forms" for the DoEvents, the IDE says
"System.Windows .Forms doesn't contain any public member(s) or cannot
be found."
Apparently DoEvents can not be used in a WPF application because it is
not a Windows Forms.
OK, so how do I get WPF to visually "blink" some text fields in
response to a button push?
How do I replace the DoEvents functionality in a WPF application?

Are you referencing System.Windows. Forms.dll?

--
Tom Shelton- Hide quoted text -

- Show quoted text -
System.Windows. Forms is not listed in the available Namespaces under
References in Project Properties.
I do not think that System.Windows. Forms can be referenced in a WPF
application.
Mar 18 '08 #3
Apparently DoEvents can not be used in a WPF application because it is
not a Windows Forms.
OK, so how do I get WPF to visually "blink" some text fields in
response to a button push?
How do I replace the DoEvents functionality in a WPF application?
You could try :
http://shevaspace.spac es.live.com/blog/cns!FD9A0F1F8DD 06954!411.entry

Not familiar yet with WPF but you could perhaps do that by using a WPF
animation ?

--
Patrice

Mar 18 '08 #4
On 2008-03-18, Don <db*******@gmai l.comwrote:
On Mar 18, 12:16*pm, Tom Shelton
<tom_shel...@Y OUKNOWTHEDRILLc omcast.netwrote :
>On 2008-03-18, Don <dbaech...@gmai l.comwrote:


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.Upda teLayout( ), and the reload the text field from the
database. But the text fields are not cleared long enough to see them
blink.
So I add a Thread.Sleep(20 0) before reloading the text fields. Still
no visual blink.
So I change the Sleep(200) to Sleep(2000), Still no visual blink.
So I attempt to add an Application.DoE vents so that the application
gets a chance to repaint the screen. But when I attempt to add the
"Imports System.Windows. Forms" for the DoEvents, the IDE says
"System.Windows .Forms doesn't contain any public member(s) or cannot
be found."
Apparently DoEvents can not be used in a WPF application because it is
not a Windows Forms.
OK, so how do I get WPF to visually "blink" some text fields in
response to a button push?
How do I replace the DoEvents functionality in a WPF application?

Are you referencing System.Windows. Forms.dll?

--
Tom Shelton- Hide quoted text -

- Show quoted text -

System.Windows. Forms is not listed in the available Namespaces under
References in Project Properties.
It wouldn't be unless you reference the dll - System.Windows. Forms.dll.
I do not think that System.Windows. Forms can be referenced in a WPF
application.
Huh? You just need to referece System.Windows. Forms.dll. You can use
Windows forms controls inside of a WPF app, so you most definately can
reference the dll. You just have to add the reference manually.

Of course, since this is a wpf app, using Application.DoE vents is
probably not the right solution anyway...

You might want to look here for a wpf implementation:

http://shevaspace.spac es.live.com/blog/cns!FD9A0F1F8DD 06954!526.entry

The code is C#, but, it should be a fairly simple conversion (the code
is not very complex).

I wonder if you can get your blink effect without using a sleep... Have
you tried looking at the wpf animation support?

--
Tom Shelton
Mar 18 '08 #5
Don,

Why are you using a Ready To Marked version while the version is allready
for quiet a while on the marked.

Are you sure you use a non official released VS 2008 version, I have never
seen that a RTM version was not released.
VS 2008. Something is RTM as it is not *official* released.

By the way, for the progam languages is VSTS exactly the same as every VS
version, it has only tools extentions to be uses by teams.

Cor

"Don" <db*******@gmai l.comschreef in bericht
news:6a******** *************** ***********@x30 g2000hsd.google groups.com...
>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.Upda teLayout( ), and the reload the text field from the
database. But the text fields are not cleared long enough to see them
blink.

So I add a Thread.Sleep(20 0) before reloading the text fields. Still
no visual blink.

So I change the Sleep(200) to Sleep(2000), Still no visual blink.

So I attempt to add an Application.DoE vents so that the application
gets a chance to repaint the screen. But when I attempt to add the
"Imports System.Windows. Forms" for the DoEvents, the IDE says
"System.Windows .Forms doesn't contain any public member(s) or cannot
be found."

Apparently DoEvents can not be used in a WPF application because it is
not a Windows Forms.

OK, so how do I get WPF to visually "blink" some text fields in
response to a button push?
How do I replace the DoEvents functionality in a WPF application?
Mar 19 '08 #6
Don
On Mar 18, 2:21 pm, Tom Shelton
<tom_shel...@YO UKNOWTHEDRILLco mcast.netwrote:
On 2008-03-18, Don <dbaech...@gmai l.comwrote:
On Mar 18, 12:16 pm, Tom Shelton
<tom_shel...@YO UKNOWTHEDRILLco mcast.netwrote:
On 2008-03-18, Don <dbaech...@gmai l.comwrote:
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.Upda teLayout( ), and the reload the text field from the
database. But the text fields are not cleared long enough to see them
blink.
So I add a Thread.Sleep(20 0) before reloading the text fields. Still
no visual blink.
So I change the Sleep(200) to Sleep(2000), Still no visual blink.
So I attempt to add an Application.DoE vents so that the application
gets a chance to repaint the screen. But when I attempt to add the
"Imports System.Windows. Forms" for the DoEvents, the IDE says
"System.Windows .Forms doesn't contain any public member(s) or cannot
be found."
Apparently DoEvents can not be used in a WPF application because it is
not a Windows Forms.
OK, so how do I get WPF to visually "blink" some text fields in
response to a button push?
How do I replace the DoEvents functionality in a WPF application?
Are you referencing System.Windows. Forms.dll?
--
Tom Shelton- Hide quoted text -
- Show quoted text -
System.Windows. Forms is not listed in the available Namespaces under
References in Project Properties.

It wouldn't be unless you reference the dll - System.Windows. Forms.dll.
I do not think that System.Windows. Forms can be referenced in a WPF
application.

Huh? You just need to referece System.Windows. Forms.dll. You can use
Windows forms controls inside of a WPF app, so you most definately can
reference the dll. You just have to add the reference manually.

Of course, since this is a wpf app, using Application.DoE vents is
probably not the right solution anyway...

You might want to look here for a wpf implementation:

http://shevaspace.spac es.live.com/blog/cns!FD9A0F1F8DD 06954!526.entry

The code is C#, but, it should be a fairly simple conversion (the code
is not very complex).

I wonder if you can get your blink effect without using a sleep... Have
you tried looking at the wpf animation support?

--
Tom Shelton
A modified version of the code that you referenced from shevaspace
worked just fine. I got the DoEvents and Blink functionality that I
was looking for. THANK YOU VERY MUCH !!

I wrote the two following routines in VB:

Imports System.Windows. Threading
Imports System.Threadin g
Public Sub DoEvents()

Application.Cur rent.Dispatcher .Invoke(Dispatc herPriority.Bac kground,
New ThreadStart(Add ressOf doNothing))
End Sub

Public Sub doNothing()

End Sub

And then in my application the pseudo code goes:
Public Sub OnLoadButton_Cl ick( )
Clear TextFields
DoEvents( )
Fill TextFields from Database
End Sub

This gives me the "Blink" that I needed that visually shows Blank Text
fields briefly before the Text fields are reloaded so that the User
notices that something happened each time the LoadButton is clicked.

It is frequently helpful to be able to force(allow) a screen update
and a short time delay to occur before any remaining code is executed
for purposes like this.

This will be a helpful technique for many VB WPF developers.

THANKS again for your help.
Mar 19 '08 #7
"Cor Ligthert[MVP]" <no************ @planet.nlschri eb:
Why are you using a Ready To Marked version while the version is allready
for quiet a while on the marked.
RTM <"Ready To Market". The RTM version is the version which is finally
distributed (sent to the manufacturer who creates the CDs/DVDs).

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

Mar 19 '08 #8

">Why are you using a Ready To Marked version while the version is
allready
>for quiet a while on the marked.

RTM <"Ready To Market". The RTM version is the version which is finally
distributed (sent to the manufacturer who creates the CDs/DVDs).
Yes and?

Cor

Mar 20 '08 #9
Cor Ligthert[MVP] wrote:
">Why are you using a Ready To Marked version while the version is
allready
>>for quiet a while on the marked.

RTM <"Ready To Market". The RTM version is the version which is
finally distributed (sent to the manufacturer who creates the
CDs/DVDs).

Yes and?
and it is therefore okay and good to use a RTM version...
Mar 20 '08 #10

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

Similar topics

24
3285
by: bazad | last post by:
Hi, I'd like to understand consequences of Application.DoEvents call. Does it create a new thread? Thank you
3
4787
by: dotNETDavid | last post by:
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.Application.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.
6
4297
by: Ollie Riches | last post by:
I understand the use of Application.DoEvents() to process all outstanding messages on the message queue in a winforms application if you have long running process on the UI thread. But can anyone explain to me why I need to call DoEvents when I am using a COM component that calls back to into the ..Net application? - If I don't call DoEvents after receiving a callback then sometimes no more messages are pumped, it appears that the message...
17
2396
by: Lance | last post by:
I've noticed that calling DoEvents is much slower in an application that has called Application.EnableVisualStyles 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.EnableVisualStyles Application.DoEvents Application.Run(New...
3
20135
by: Rich | last post by:
As I migrate my VB6 apps to vb.net I am checking what features I need to retain from vb6. In vb6 I noticed that DoEvents really made a performance difference when I called it just before a Do/For loop for large datasets. I hope do some multithreading in vb.net for this. But I am not completely sure about how System.Windows.Forms.Application.DoEvents() works, or its application/purpose. Is this the same as
7
1887
by: Tym | last post by:
Made the change from vb6 to vb.net and have found that DoEvents() doesn't work!! Well, the replacement System.Windows.Forms.Application.DoEvents() is causing hell!! I have a loop such as
13
10101
by: Amjad | last post by:
Hi, Is there an equivalent to the "Application.Doevents" method in modules or Windows services? I want to make a Windows service that calls a DLL. The DLL would have all my functions and it would be doing all the job, but some of the functions that I'm using require calling something like "Application.Doevents" and I can't use this because the DLL module is not an application.
5
4578
by: james.jdunne | last post by:
System.ArgumentException: Item has already been added. Key in dictionary: "-1" Key being added: "-1" at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at System.Collections.Hashtable.Add(Object key, Object value) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FRegisterComponent(IMsoComponent component, MSOCRINFOSTRUCT pcrinfo, Int32& dwComponentID) at...
4
10929
by: Woo Mun Foong | last post by:
Hi, I have a DLL that is used to carry out some lengthly process. I would like to have something similar to DoEvents that can yield control back to Windows every now and then. Any ideas ? Thank You,
0
9456
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...
1
9843
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
9713
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
8713
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...
0
5142
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
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
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
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.