473,574 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1399
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.co mwrote in message
news:%2******** ********@TK2MSF TNGP04.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
3430
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 database. This works fine. However, I attempt to notify the user when data accesses occur. The way I attempt to accomplish this is by changing the...
5
3779
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 save their changes and they can respond with yes, no or cancel. If they press cancel, the entry form stays active with the changes still entered. ...
2
1528
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, and during execution one event seems to preempt the execution of the other. My code looks similar to the following: private void...
1
1912
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 the button click event occurring afterwards. The button click event then runs the code to forward the user to the next web page. My problem is...
2
2125
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 database. This works fine. However, I attempt to notify the user when data accesses occur. The way I attempt to accomplish this is by changing the...
9
2460
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 post event will always execuate after the system is completed... - I want to wrap this functionality in a framework, so I could possibly have 3 or 4...
1
5349
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 webusercontrol fires a postback event. On postback
4
6101
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: Unexpected error occurred in Sub ButtonOne_Click on frmMainMenu... 2473 The expression On Menu you entered as the event property setting produced the...
0
7835
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...
0
8095
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. ...
1
7847
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...
0
8132
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...
1
5645
isladogs
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...
0
5332
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3769
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...
0
3787
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2265
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 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.