This is a project for creating code like the WMI Code creator but the output is for VB.Net and Windows Forms Instead of for a Console Application.
The Project Reason
Anyone that has used the WMI Code Creator knows how fast you can get up and going. Since most of my programs that use WMI are Windows forms it was becoming a time consuming thing to create the code with the selected properties from the WMI Code Creator and then port that code to a Windows forms style application.
So I decided to see if I could build my own code creator for faster builds. When you have 15 properties is takes a lot of time, and to make sure you spell them correctly or you end up with a “Not Found” error for a property name that was misspelled.
This project is still a work in progress. There are a few known Issues.
The Building of the program:
I first started out by looking at the WMI Code Creator wanting to keep some of the same feel of that program.
My first version had a checked list box, but you had to click twice for every property you wanted to select. So I later changed that to a regular list box. One left click does it.
Then I used a rich text box but you don’t get the instant right click copy ability so I changed that to a regular text box.(was having to use CTL+ C to do it while testing)
Using the program
To use this program right click and run as admin (just to avoid some problems).
After the splash screen closes, the main form will open and the Namespace list will be filled.
Select a namespace, then the Classes list will fill. The number above tells how many classes or name spaces were found.(still need to work on that part)
Once you have selected a class, the list box will fill with the properties. Select the properties you want by left clicking on them(unless your buttons are reversed), if the property name is highlighted, then it is selected. You can left click again to unselect.(the select method in the list box properties page is multi simple)
Then Just click on the Create code button and the output text box will fill.
Again, not all classes will return information, you may want to use one of the following application to see what gets returned before building a new application, and to help pick any properties you may want use. Some property names never return anything, so no point cluttering up your output with the extra property names. The selected class also may not return anything at all.
What I really liked about this article, besides the fact it's WMI, VB.Net and the source is available, is how the author goes into some details on the problems he ran into and solved, what his thinking was. Finally the reference list was nice touch.