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

Event's code runs to completion before another event's code is entered?

If the user types into the TextBox of a combobox it works OK. But if he hold
a key down so the letter repeats quickly the code runs into trouble.

My questions are:

Is it true that an event's code is normally run to completion before another
event's code is entered (KeyUp in my case)?

If that is true and there are exceptions that let another event start do
they include:

When DoEvents is executed?
When File I/O is executed?

Any others...

I don't believe there is a DoEvents in the executed code but there is
definitely file I/O.

It's a large program and difficult to find things out by experimenting. If I
had the answers to the above it would help much.

Thanks
Oct 30 '07 #1
3 1389
Academia wrote:
If the user types into the TextBox of a combobox it works OK. But if he hold
a key down so the letter repeats quickly the code runs into trouble.
What kind of trouble?
My questions are:

Is it true that an event's code is normally run to completion before another
event's code is entered (KeyUp in my case)?
The events are queued in the message queue of the application, and the
queue is handled in the main thread, one message at a time.
If that is true and there are exceptions that let another event start do
they include:

When DoEvents is executed?
Yes, the DoEvents call will consume any available messages from the queue.
When File I/O is executed?
No.
Any others...
No.

--
Göran Andersson
_____
http://www.guffa.com
Oct 30 '07 #2
I just erassed the answer I was typying because something occured to me.

Holding a key down proprably generates many KeyPreses but no KeyUp event
until the key is released.

Not sure what other events are raised, but maybe TextChanged and others are
happening without the KeyUp I expected per input character and coded for.

I'll have to go look at the code.

Any way I can run the code and see which events were raised between the
KeyPress and the KeyUp events?

thanks

"Göran Andersson" <gu***@guffa.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Academia wrote:
>If the user types into the TextBox of a combobox it works OK. But if he
hold a key down so the letter repeats quickly the code runs into trouble.

What kind of trouble?
>My questions are:

Is it true that an event's code is normally run to completion before
another event's code is entered (KeyUp in my case)?

The events are queued in the message queue of the application, and the
queue is handled in the main thread, one message at a time.
>If that is true and there are exceptions that let another event start do
they include:

When DoEvents is executed?

Yes, the DoEvents call will consume any available messages from the queue.
> When File I/O is executed?

No.
It must release the CPU while waiting for the i/o to complete.

>
> Any others...

No.

--
Göran Andersson
_____
http://www.guffa.com

Oct 30 '07 #3
Academia wrote:
Holding a key down proprably generates many KeyPreses but no KeyUp event
until the key is released.
Correct.
Not sure what other events are raised, but maybe TextChanged and others are
happening without the KeyUp I expected per input character and coded for.
The key events are put in the same queue as other events, and are
handled by the same message pump. If a keypress for example changes the
apperance of a control, the messages that tells the control to change
itself is added to the message queue.
Any way I can run the code and see which events were raised between the
KeyPress and the KeyUp events?
You could add Debug.Write statements to the event handlers, so that you
can track what's happening. (Debugging and putting break points in the
event handlers might not work very well, as you interfer so much on the
event handling process that way.)
>> When File I/O is executed?
No.

It must release the CPU while waiting for the i/o to complete.
Yes, but not to the thread that called the I/O operation. Whatever the
computer does while waiting for the I/O, it's not consuming event
messages in your application.

--
Göran Andersson
_____
http://www.guffa.com
Nov 1 '07 #4

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

Similar topics

1
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the...
5
by: Maxine G | last post by:
I have two forms, a menu and a data entry form. The entry form is bound to a query against linked SQL server tables. In the deactivate event, I have some code which asks the user if they want to...
2
by: James | last post by:
Hi all, I am seeing some unexpected behaviour in a single threaded winforms app and was hoping someone could explain what is going on. I have two events attached to a chart control on my form,...
1
by: steven.varr | last post by:
Hi, The system I am working on handles web page navigation in the following fashion: When a button is clicked on a web page a post-back is triggered. The page_load event occurs as usual with the...
2
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the...
9
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the...
1
by: Jeremy Martin | last post by:
Hi, I am currently learning c# so be gentle :) I am converting a Delphi.NET website to c# website and I am confused as to how events are handled. 2 Situations. 1. A component on a...
4
by: MLH | last post by:
I have an error #2473. I don't think it is related to References. I rolled out an A97 mde file that runs on several machines - but gives me this error on one workstation??? Here's the error: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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,...
0
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...
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.