473,398 Members | 2,403 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,398 software developers and data experts.

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.UpdateLayout( ), 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(200) 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.DoEvents 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 5143
On 2008-03-18, Don <db*******@gmail.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.UpdateLayout( ), 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(200) 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.DoEvents 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...@YOUKNOWTHEDRILLcomcast.netwrote:
On 2008-03-18, Don <dbaech...@gmail.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.UpdateLayout( ), 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(200) 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.DoEvents 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.spaces.live.com/blog/cns!FD9A0F1F8DD06954!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*******@gmail.comwrote:
On Mar 18, 12:16*pm, Tom Shelton
<tom_shel...@YOUKNOWTHEDRILLcomcast.netwrote:
>On 2008-03-18, Don <dbaech...@gmail.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.UpdateLayout( ), 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(200) 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.DoEvents 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.DoEvents is
probably not the right solution anyway...

You might want to look here for a wpf implementation:

http://shevaspace.spaces.live.com/blog/cns!FD9A0F1F8DD06954!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*******@gmail.comschreef in bericht
news:6a**********************************@x30g2000 hsd.googlegroups.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.UpdateLayout( ), 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(200) 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.DoEvents 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...@YOUKNOWTHEDRILLcomcast.netwrote:
On 2008-03-18, Don <dbaech...@gmail.comwrote:
On Mar 18, 12:16 pm, Tom Shelton
<tom_shel...@YOUKNOWTHEDRILLcomcast.netwrote:
On 2008-03-18, Don <dbaech...@gmail.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.UpdateLayout( ), 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(200) 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.DoEvents 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.DoEvents is
probably not the right solution anyway...

You might want to look here for a wpf implementation:

http://shevaspace.spaces.live.com/blog/cns!FD9A0F1F8DD06954!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.Threading
Public Sub DoEvents()

Application.Current.Dispatcher.Invoke(DispatcherPr iority.Background,
New ThreadStart(AddressOf doNothing))
End Sub

Public Sub doNothing()

End Sub

And then in my application the pseudo code goes:
Public Sub OnLoadButton_Click( )
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.nlschrieb:
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
>
and it is therefore okay and good to use a RTM version...
But there is no need to express that here

:-)

Cor
Mar 20 '08 #11
Cor Ligthert [MVP] wrote:
>and it is therefore okay and good to use a RTM version...
But there is no need to express that here

:-)

Cor
You asked the question: "Why are you using a Ready To Marked version while the
version is allready for quiet a while on the marked."

Therefore you got an answer.

By the way, RTM = Released to Manufacturing.
Mar 20 '08 #12

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

Similar topics

24
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
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...
6
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...
17
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...
3
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...
7
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
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...
5
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...
4
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 ? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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...
0
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...
0
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...
0
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,...

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.