473,569 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a UserConctrol needs to raise an event when it starts

Often I have a problem like the following:
..

This is the way I think things happen is:
If the usercontrol raises the event when it is first created (I.e., in it's
New, or in it's Enter event, or in it's HandleCreated event...) the Form,
which caused the control's New to run, is itself being created and is not
yet ready to receive an event, so the raised event is lost.

I could put a timer on the control or have the form somehow (via a call to a
sub or property...) cause the event to be raised, but that seems clunky.

Any suggestions?
Thanks
Nov 21 '05 #1
5 1141

" Just Me" <gr****@a-znet.com> wrote in message
news:ei******** ******@TK2MSFTN GP11.phx.gbl...
Often I have a problem like the following:
.

This is the way I think things happen is:
If the usercontrol raises the event when it is first created (I.e., in it's New, or in it's Enter event, or in it's HandleCreated event...) the Form,
which caused the control's New to run, is itself being created and is not
yet ready to receive an event, so the raised event is lost.

I could put a timer on the control or have the form somehow (via a call to a sub or property...) cause the event to be raised, but that seems clunky.

Any suggestions?


Use the PAINT event to raise the event. Set a flag when fired so you don't
fire it on every Paint event
Nov 21 '05 #2
sound good, I'll try it now

Thanks a lot

"Noozer" <do*******@me.h ere> wrote in message
news:O8******** ******@TK2MSFTN GP15.phx.gbl...

" Just Me" <gr****@a-znet.com> wrote in message
news:ei******** ******@TK2MSFTN GP11.phx.gbl...
Often I have a problem like the following:
.

This is the way I think things happen is:
If the usercontrol raises the event when it is first created (I.e., in

it's
New, or in it's Enter event, or in it's HandleCreated event...) the Form,
which caused the control's New to run, is itself being created and is not
yet ready to receive an event, so the raised event is lost.

I could put a timer on the control or have the form somehow (via a call
to

a
sub or property...) cause the event to be raised, but that seems clunky.

Any suggestions?


Use the PAINT event to raise the event. Set a flag when fired so you don't
fire it on every Paint event

Nov 21 '05 #3
work great
thanks
"Noozer" <do*******@me.h ere> wrote in message
news:O8******** ******@TK2MSFTN GP15.phx.gbl...

" Just Me" <gr****@a-znet.com> wrote in message
news:ei******** ******@TK2MSFTN GP11.phx.gbl...
Often I have a problem like the following:
.

This is the way I think things happen is:
If the usercontrol raises the event when it is first created (I.e., in

it's
New, or in it's Enter event, or in it's HandleCreated event...) the Form,
which caused the control's New to run, is itself being created and is not
yet ready to receive an event, so the raised event is lost.

I could put a timer on the control or have the form somehow (via a call
to

a
sub or property...) cause the event to be raised, but that seems clunky.

Any suggestions?


Use the PAINT event to raise the event. Set a flag when fired so you don't
fire it on every Paint event

Nov 21 '05 #4
Just me,

Why are you not just calling in the new sub the event you want to call?

Cor
Nov 21 '05 #5

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:eh******** ******@TK2MSFTN GP12.phx.gbl...
Just me,

Why are you not just calling in the new sub the event you want to call?

Cor

I think you mean:
Why are you not just Raising in the new sub the event you want to raise

If so, as I said in the post - I think the control's New runs before the
form is ready to receive events.

But the first time the control's Paint is raised seems to be late enough so
that it works there (Info from to Noozer).

Thanks

Nov 21 '05 #6

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

Similar topics

1
10500
by: Dan Cimpoiesu | last post by:
I have a remoting object, derived from MarshalByRefComponent, that I instantiate on the client side, with Activator.GetObject. Can I receive events fired on the server, on the client? How?
2
1903
by: Andrew | last post by:
Hi, friends, I need to raise certain events in my VC# windows control library. Any reference paper or sample source code for help? Thanks a lot...
12
2926
by: Vittorio Pavesi | last post by:
Hello, is it possible to manually raise the event Elapsed of the timer object ? Vittorio
3
2113
by: moondaddy | last post by:
I wrote my own List class which I use to bind to list controls. this class inherits CollectionBase and implements IBindingList. This class contains a list of business classes such as customers for example. In the customer class I have an event called MyTestEvent and when certain conditions arise, I want to raise this event which would...
7
2878
by: Phil Mc | last post by:
Hi all I have a small scheduling application that I have written which will be running on a Windows 2003 server. This application is started at different times by an 'autosys' job (though I am testing by manually starting the app from the server, that is logging into the server, and running). This app depending on available resources (txt,...
1
1760
by: Jeff Williams | last post by:
I need to monitor for when an exe (application) starts. This will trigger an alert. The application will be one the user starts and monitoring will be only required on the pc they are logged in on. Could someone direct me to what the best way to do this is. Regards Jeff
3
2119
by: =?Utf-8?B?Ulc=?= | last post by:
I constructed a new Class with some private members. I would like an event to be raised on the moment the value of one of those private members is changed. How do I define an event for that private member and how do I raise the event? -- RW
5
1998
by: Mike | last post by:
Hi group; Let say I have an object called Account, that raises an event called AccountLow with its owns EventArgs, and when this event gets raised, I will like to raise another custom event called AccountGotLowAmount and passes AccountLow’s EventArgs along with the new event.
11
4012
by: nadeem_far | last post by:
Hello, I am working on a c# project using framework 1.1. Since its a console application,no windows forms are being used. I am trying to implement event driven classes that just want to raise the event and continue working( like fire and forget - do not wait for the event handler in client to finish.) I have gone through alot of the...
0
7924
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. ...
0
8120
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...
1
7672
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
7968
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...
0
6283
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...
0
5219
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
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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
0
937
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...

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.