Hi, a simple question.
Say I have a connection object in a button event handler. I want to add a
message box that pops up to say the state of the connection has changed
whenever I open the connection by pressing the button in which the instance
of the connection object resides. I use the event handler below to do this:
sqlCon.StateChange+=new StateChangeEventHandler(methodToHandleThis);
My question is where to put this piece of code?
Thanks for any answers in advance
Ant
Ah, there is a StateChang(ed)? event handler on the Connection object...
perhaps there?

Signature
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
> Hi, a simple question.
>
[quoted text clipped - 11 lines]
> Thanks for any answers in advance
> Ant
Ant - 16 Jan 2006 22:47 GMT
Hi William, thanks for your response; maybe my question isn't quite 'that'
simple.
The thing is, I am using the correct event handlers, but the connection
being instantiated in a button click event & not 1) being global to the form
& 2) not having a design time property box as it is a 'coded connection', I'm
left wondering where I would put the statechanged event handler.
Thanks for your time on this
Ant
> Ah, there is a StateChang(ed)? event handler on the Connection object...
> perhaps there?
[quoted text clipped - 14 lines]
> > Thanks for any answers in advance
> > Ant