winzip icon

At last! A solution to the Select Case Enum problem! Believe me, you want this code

Submitted on: 2/6/2015 9:46:00 PM
By: grigri (from psc cd)  
Level: Intermediate
User Rating: By 15 Users
Compatibility: VB 6.0
Views: 624
     The VB IDE's intellisense features really are a godsend. However, a few omissions in its conception are a bit annoying. For example, when you are doing a Select Case statement with an enum value, you would expect the intellisense to pop up a list box of all the enum values, like it does if you were in an If statement. That's exactly what this add-in does. It adds this functionality to the IDE. I have seen several ideas of how to get around this limitation, but none that take it this far. It's not really surprising that no one else has done it. The objects add-ins get to play with to query and manipulate the code conveniently ignore the existence of Enums, totally. So you really have to do it the hard way - parsing the strings until you find the right one. If none is found then it falls back on the typelibs the project references, hoping to find it there. I'm not going to delve into a detailed description of how the parsing system works, because it's really not that complicated. It's just long, annoying, and with lots of pitfalls to watch out for. The parsing code itself could be is very useful to anyone wanting to parse VB code, for any reason. Little gems like GetModuleEnums() or GetProcParams() could prove themselves handy in any number of situations. I'm not saying the code is bug-free, because it almost certainly isn't. It does however work in every circumstance I have tested, and has yet to crash the IDE. A lot of improvements could be made to this code. Caching the parsing results would dramatically improve search speed, and the parsing algorithms themselves could be vastly accelerated. Still, it works. Here's a list of exercises left "for the reader" :) * Improve the parsing algorithms, possibly by using array pointers instead of string manipulation * Cache results so they don't have to be repeated every time * Extend the concept to popup a list of labels when the user types "Goto " or "GoSub " * Implement sorting in the list box [as an option, as it's not always appropriate] * In the enum pop-up box, check which values have already been checked for in the Select Case statement, and draw them in grey, or strike through, or something. Anyway, have fun, enjoy the code, and don't forget to send me your comments [and your vote :) ] If you use any of the code, please let me know [I won't mind, honest, but I'd like to be informed, for my ego's sake if nothing else]. grigri

winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net

Other 8 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

8/2/2017 2:01:45 PMEvariste Galois

Nice job! Simple, but quite effective.
(If this comment was disrespectful, please report it.)


Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.