Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / January 2006

Tip: Looking for answers? Try searching our database.

Where to put an event handler

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ant - 15 Jan 2006 10:44 GMT
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
William (Bill) Vaughn - 15 Jan 2006 19:48 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.