Simple Question about Annoying Issue

palehorse

Active member
Joined
Jan 28, 2005
Messages
34
Programming Experience
1-3
Hello all,

I am new to VB.NET and have a simple question for you. Besides "Don't change then name of your control!" or "Make sure you name it right the first time!" How do I get my code to reflect the changing of the name of one of my controls?

For instance, I have a button named btnHello and double click it, it takes me to the Code Designer and creates the Click Event for btnHello. Now, I notice that it begins with something like btnHello_Click................Handles btnHello.Click

If, in the Form Designer - I change the name to btnWorld and double click it, it takes me to the code designer, but still says btnHello_Click, but goes on saying Handles btnWorld.Click

Is there a setting to change this, if not - why doesn't it change the btnHello_Click to btnWorld_Click?
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
The btnHello_Click is just the name of the sub. You code will still work fine as long as the handles is correct. I would suggest renaming the sub to btnWorld_Click (or something else) so you code is easy to follow.

TPM

BTW: In case you didn't know Subs can have more than 1 handles, thus you can have 1 sub for several controls which, if they do the same thing can save code and makes it a lot cleaner.
 
Top Bottom