Maybe it’s just me.
Maybe I’m just having a bad day.
Or maybe the Help isn’t as intuitive in VS2005 as it was in VS 2003.
Or maybe it’s just that there’s so darn much new stuff in VB/VS2005 that I just can’t track it all down in the Help files.
Whatever the reason, I really do feel as though I’m spending far longer trying to pinpoint the answers to relatively easy questions these days.
Today, for instance, I wanted to put some code in the OnPaint event of a Windows Form. (OK, I know that I could just as easily have used the basic Paint event, but OnPaint is what I’m used to, and OnPaint is what I wanted. )
In the earlier versions of Visual Studio there is that convenient little line in the Code Window’s left hand drop down list. But when you go to select this feature in VS2005 you’ll discover that it’s no longer available. When I hit this point I then spent an awful lot of time trying to work out a way of getting this feature back into the IDE thinking – wrongly – that this was probably a matter of tweaking one of the settings in the Visual Studio configuration.
After what seemed like an endless search I eventually found that the fix for this was something quite different. What you have to do is to type in the word “Overrides” into the code window main area itself and when you do this an Intellisense list of options will appear.
Now, don’t get me wrong. I’m all for improvements and I can see that once you know about it that the new approach is just as easy as the old one – and it even comes with a few additional benefits.
1. Firstly, it will intelligently auto-select the first letters of the Overrides as you type them in. That’s to say that – unlike the 2003 version – if you type in :
for example, you will be taken to the first entry that has all these four letters in that exact order (which just happens to be OnClick). Now, this is miles better than the very annoying feature in VS2003 which would have had you whizzing up and down the list and highlighting
one after the other.
So that’s a great improvement.
2. Secondly, the Intellisense listing, in true Intellisense style, also includes the parameters; something not shown in the VS 2003 dropdown list.
3. And thirdly, once you have used one of the Overrides from the list and it exists as a code block in your code window, this choice of Override no longer appears in the Intellisense list.
So, now that I’ve found it, I do actually prefer the new way . I just wish I could have found the answer with a few well chosen keywords in the VS2005 Help and not had to spend ages digging round for it. I tried lots of search term variations but mostly I only found guidance on the use of Overrides in code or different ways of manipulating toolbars and menus in Visual Studio.
In the end, I did what I often seem to end up doing these days – I Googled with the same search terms that had failed in VS and fairly swiftly found the answer tucked away in the blog of Mike Carter, one of the VBIDE Team guys at Microsoft.
So there you are, that’s how you can code the Overrideable events now. If you’ve found your way to this blog at the end of a similar frustrating search, I hope you managed to get to the answer faster than I did!
Maybe I just wasn’t smart enough to come up with the right combination of search terms to home in on it in VS2005 Help.
Or maybe I’m just getting impatient in my old age :-}