preceding with caution - with regards to REMOVEHANDLER and ADDHANDLER

My Project "WHICH IS ALREADY A YEAR BEHIND SCHEDULE" - mostly because of rewrites, mis-understandings, mis-interpretations, etc
I am a little un-nerved about starting to REMOVE the HANDLES clause in some of my event procedures - although it fits the current purpose -

 wouldn't it also create code that should be auto-run and now it's not being run - because the HANDLES clause is no longer present?
AND YOU WOULD HAVE NO WAY OF KNOWING THAT - OR IT WOULD BE DIFFICULT TO FIGURE OUT - MORE DEBUG NIGHTMARES

which could cause say not properly formatted data in databases, etc - as an example with the .cellvaluechanged event?

just trying to avoid more rework - because I'm quite a ways along with this FIRST vb.net project and time is running out!

I guess what I'm trying to find out is - Is there a way to not touch the HANDLES clause and IN CODE tell the system not to run the said event!
MBHEY131Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
I don't understand your concern.

You write code in the event handlers for the events you want to do something specific. Sometimes you need to add some code to these handlers to bypass them. For example, you might check on the first line of your handler if your grid's DataSource is nothing to return.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MBHEY131Author Commented:
that's a good point - nothing in the datasource then go out of the sub -but then that code would get launched for every cell that gets filled "WHICH IS WHAT IS HAPPENING NOW"- in the case of the .CELLVALUECHANGED event - when the FORM LOAD code is run - as is my limited understanding of VB.NET - well I can't over think this anymore - I like the REMOVEHANDLER and ADDHANDLER with the HANDLES clause removed - and will have to adjust future code as needed - thanx for the input!
Éric MoreauSenior .Net ConsultantCommented:
Place a breakpoint in your event handler and check the call stack to see what causes the event to be raised.
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

MBHEY131Author Commented:
I'm not going to call the event .cellvaluechanged at FORM LOAD at all - have DELETED - HANDLES clause! - but 1 more question and I promise I'm done with this issue -

Where would you put the ADDHANDLER - once the FORM gets loaded
My first choice will be at the very end of the FORM LOAD event!
Is there a better way?
Éric MoreauSenior .Net ConsultantCommented:
the end of Form_Load is usually the best place
Éric MoreauSenior .Net ConsultantCommented:
Or it can be after you loaded the grid for the first time (if grid events)
MBHEY131Author Commented:
ended up moving my code to the .mouseup event - and all works great!
 nice to know a little something about the events!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.