*

Visual Basic 6.0: Desktop Applications Challenge Labs

Part 1

Week 1:

Well, nothing like jumping right in with some elementary VB exercises! ;-) Your Challenge Lab for this week (should you choose to accept it...) is to be able to tell someone what day of the week they were born on (i.e. Tuesday, Friday, etc.). After doing that for one person, be able to do it for at least two people, and then calculate how many days apart they are.  Here's mine - the UI isn't pretty - in fact, it's quite ugly and follows absolutely no standards, but it's the code you're interested in anyhow, right? :-)


More Week 1:

My brain does strange things in the wee hours of the morning...(ok, pretty much any time... ;-) and so I decided to write a little program to reverse a string (yes, VB6 has a built-in function to do this already, but it's not formatted the way I wanted it). Then, I thought, why not introduce the students to a nifty way of doing passwords - something I call "hackerizing"...and thus was born this lame little program that I've attached here.

So, how is this a Challenge Lab? Well, you don't have to download the attachment and look at it first, you know :-) Your task: build a little application (standard executable) that will take a string and reverse it, capitalizing the first letter of each word of the new string. Then, using some algorithm of your choosing, give the user an option to replace certain letters in your string with the shift-number/"colorful metaphor" keys (~!@#$%^&*). For example, my name, Karla, would come out as @!r@k, given my particular method of hackerizing. Have fun!

[After a discussion of Replace vs. Mid]

After doing battle with the label control and the &, I decided to change the display control to a borderless, flat, button-colored text box. I've also cleaned up my code a bit - Hack is now a separate function. I was going to change the older Mid$ statement to the newer Replace function, but discovered from this attached VBPJ pdf article that new doesn't necessarily translate to faster. As well, I changed the command buttons to the Windows standards size of 1200 twips wide by 400 twips tall and added a Clear button.


Week 2:

We'll do some more general VB calisthenics this week before moving onto difficult UI things in weeks 3 and 4...

Sending text messages to folks' cell phones is becoming more and more popular (hey, at least I use it a bunch...). Write a program that will assist someone in composing a short message (limit it to 110 characters, including the From, Subject and Message) that they can copy and paste into either an email or web interface (or even their cell phone). Minimally, the user should know when they've reached the 110 character (include spaces - they count) limit. For extra added fun, offer suggestions for abbreviations to the user if they are running out of space, such as "2" for "to" and "4" for "for" (yes, this means you'll have to think like a teenaged hacker, but, hey, I prepared you for that in the last Challenge Lab! ;-)

Here's what I came up with - and there's even a few comments! (not many...don't get too excited ;-)

Stay tuned for more exciting Week 2 Challenge Lab embellishments!

[After an exciting discovery....]

Golly, I thought my Nokia 1260 AT&T phone only accepted messages of 110 characters (based on the info given on their web client page), but it turns out it accepts 160 characters...go figure...I used to have the 5165 and I think it only accepted 110 characters.


Return to Week 2:

Once you've got your basic program written, add functionality to make it send an email message to a cell phone (or any email address, really) using Microsoft Outlook. I've attached my code, but before you look at it, please do some hunting around on the topic of Automating Microsoft Outlook :-) If you've ever made Excel or Word or Powerpoint or Access do tricks, you can make Outlook do this trick.


Week 3:

Some of the questions on the 70-176 test will deal with how well you know (and love ;-) various User Interface controls and concepts. For your Week 3 Challenge, I'd like you to take your Week 2 and Return to Week 2 projects and give them fancy User Interfaces, taking into account all you know from previous UI design, and also your readings and Field Trips.

I think it would be good to get a class discussion going on what works and what doesn't in all our offerings, so even if you haven't completed the Challenge Labs, please feel free to contribute to the discussion. I've attached what I've come up with so far...be gentle ;-) (I'm not a UI person :-)


Week 3: The Next Generation:

One of the UI elements heavily covered on the test is menus. So, take your Week 3 project (now all fancied up) and add some menu elements, including a checked one.

Additionally, for anyone who did elect to send the message by automating Outlook, there's an interesting property of the MailItem object that allows for delayed delivery. Implement this option :-)  Here's mine.


Week 4:

Now for Part 2 of UI-land: you've got a working application, that is "pretty", and has menus. It's time to add more fun stuff, but in the area of usability.

  • If you haven't already done this, make sure all is properly labeled, appropriately tool-tipped, and the tab order (including any labels) correct.
  • Add a status bar to keep the user informed of any developments, like the date and time changing, or them running out of space.
  • Using what you've learned about Resource files (and to avoid the fragile .frx file), add an icon to the form so that when it compiles it will have its own identity. You can download a 30 day evaluation copy of a nifty little program from IconCool. Make sure you stick with the 16 color (yes, boring) ones, though.
  • Lastly, persist the user's options to the Windows Registry (you should have learned this in Mr. Smiley's Beginning VB class, but if not, let me know and I'll point you in the right direction).

As usual, I've attached my incarnation.


You Knew There Had to Be Progeny of Week 4:

Most applications that save user settings to the Registry will have a Tools->Options Dialog as a central place to do this. Implement one of those - if you find you need to modify your existing menu(s), please do.

I've attached mine - it compiles okay, but remember that we haven't learned error handling yet (;-) so considering the late hour at which it was programmed, there might be bugs. Please let me know :-)


Week 5/6: Validation

[Better late than never! %-/]

As you learned in Lessons 5 and 6, it's quite important to make sure only valid data ever gets processed. In our SMS program, for instance, it would be a problem to send a message to an invalid email address, or send it without a message (although I suppose that could convey a certain sentiment... ;-). Your task for this Challenge Lab is to use things like the Validate Event and the CausesValidation property, as well as any other means, to make sure the data entered into your form(s) is what it needs to be. I've done a bit with mine and attached it here - I'm open to any suggestions as to how to further "validate" it :-)

To Be Continued...


Challenge Lab Files


Challenge Lab Executables

Important! If you don't have Visual Basic 6 installed on your machine, you'll need to download the basic run-time files from Microsoft.

This next set of files will only work if you have Microsoft Outlook on your machine

All of them at once, with Email Address text file



Internet Content Rating Association

Alrak's Course Resources ©2002-2007 Karla Carter. All rights reserved. This material (including, but not limited to, Mini-lectures and Challenge Labs) may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. For permission, contact Karla.