A Quick Tour of Visual Studio
I catching up with Peter, who among other things teaches an Introduction to Visual Basic at Endicott College. I commented, as I do every time we meet, that I should really look into VB because there’s actually quite a lot of work being done in this environment. There are a lot of “real applications” are being done in VB. I’m not sure if there are more than for Flash; a quick visit to Monster.Com showed a 3:1 demand for VB coders versus Flashers, at least here in my neck of the woods.
Warming further to the subject, Peter showed me how to create a skeleton application in Visual Basic .NET. The entire intro took about 10 minutes, more or less. The amazing thing is that this is all I needed to get enough of a grasp of the environment to know what to do next. I imagine that any experienced Actionscript coder could pick it up and start screwing around.
Warning! Geeky notes follow!
Assuming you’ve got Visual Basic .NET 2003, create a new Visual Basic .NET Project. Then follow along with this diagram: it points out the bits of the Visual Basic IDE that are helpful in just getting something to happen on the screen. Go ahead…click to make it bigger!
Step 1: After you name and create the project, you’ll be presented with a default Form (here named “Form1″) which is the main application window. In ActionScript terms, you can think of it as the “_root movieclip”. I suppose you can eventually create and manipulate other form windows, as you can with commands like
MovieClip.createEmptyMovieClip() in Actionscript. I haven’t gotten that far :-)
Step 2: You can select a number of components from the left panel. Some of them are visual objects like buttons and textboxes. Others are non-placed objects, like the FileOpenDialog or Timer objects. Once you select a component, you can draw them on the Form you started with in Step 1.
Step 3: To actually write code, you double-click the component, which will open up the code snippet for you to edit. Peter just attached some code to the Button (here, Button1) that sets the
Text property of the object
Label1 to something else. Conceptually, it’s just like what you’re used to in ActionScript: you’re basically writing an
OnPress handler to set the
Text property of a
Here’s some other useful things to know:
- Selecting a component with a single click will show you its properties in the Property Window, assuming you have it showing. One of the buttons in the upper right of the screen (marked as “important windows” in the diagram) will bring up the property window. On the diagram, the green info boxes call these features out.
Double-clicking a component will show you the default event handler for that object. This is where you write your code. For example, double-clicking a Button will show you its “click handler”. There are more handlers, of course, which you can discover by using the various tool-tip and auto-completion tools.
You can further explore the various object properties and methods avaiable by using the Class Browser and Object Browser windows. On the diagram, the pink info boxes point out the areas you can click.
p>##Off and Running!
Congratulations, you’ve made a real Windows app! Except it doesn’t really do anything, but the Visual Studio Integrated Development Environment (IDE) is very large and very interesting to explore. Now that you know how to create and run a simple program, you have a foundation for exploring the rest of the IDE. The copious tool tips, context-sensitive help, and thousands of articles on the Microsoft Development Network now have some relevance to your existence! This is what a real IDE looks like, BTW. You’ll see that the editor supports code folding, which is wonderful. And the debugger is actually useful.
One drag is that your Visual Basic .NET app needs the (surprise!) .NET runtime, which kind of sucks because it’s feckin’ gigantic…22MB! Sigh. And I really have no idea what it is exactly, but it makes the smooth deployment of your application a pain in the butt. Flash provides a much cleaner deployment experience, plugin-detection code aside. Unless you’re deploying on CD-ROM as a stand-alone projector–ugh.
The introduction of .NET has lead to a balkanization of the Windows Programming APIs, which makes things confusing and has kept me from seriously pursuing PC development; there’s just way too much stuff you have to know to get anything to happen.
Recently, however, I’ve come to believe that just making stuff is probably more important than total comprehension or programming elegance. In other words, I should just make something and worry about elegance later. Visual Basic .NET, though it feels a bit wizardy and bloated, will at least get me familiar with the Windows API in small, digestable chunks. I am fighting the desire to first put together a comprehensive API overview to get that “big picture” view so lacking in most code documentation; I wonder who the equivalent of Moock is on the Windows Dev side of things. THAT would be helpful.
But it’s still BASIC…
BASIC itself is still kickin’ around in other interesting incarnations:
One noteable product is REALBasic, which was popular in some education research circles as a rapid development tool, and is now taking on Visual Basic as the crossplatform choice for rapid application development. I last looked at it three or four years ago, and the Windows side did not seem as stable as I would have liked. I hear it’s greatly improved these days, and they’ve added Linux to the list of supported platforms. It’s priced comparably to Visual Basic for Windows: $99 for the Standard edition (free on Linux), $399 for the Pro version.
Then there’s Dark Basic, which is a game development BASIC for Windows. You can create 3D game worlds with this package, all for a mere $49. If you want to get into a language that allows you to actually make stuff right away. And therein lies the power of BASIC: you can do stuff right away, without all the tedious mucking about with compilers, linkers and what have you. I should dig up my license and upgrade to the latest version.
Those look cool, but…
Yeah, I wasn’t entirely convinced either, so I tried out Visual C# (pronounced “C-sharp”) and Visual C++ to see how they handled the .NET side of things; Visual C# in particularly has both Java-like syntax and the Visual Basic style interface.
Check out and compare these screenshots; just look at the window title to remind you which language you’re looking at:
They’re all very similar, so if you want to get the flexibility of Visual Basic I suppose you can just start with C#. I think C# is a .NET-only framework, but I’m not entirely sure. Visual Basic may also have a lot more code modules available for it in the form of COM components (the precursor to .NET). I’m trying to get some people together locally to attack the learning challenge as a group. Like I need another project, but development of real software is one of my long term goals. I dunno why…I just like the feel of a solid desktop application. It probably has something to do with my increasing age and fading attention span…why, back in my day, we had to hand-assemble our opcodes on 8-bit processors, with only 3 registers and…Zzzzz.