Nugget Challenges and Case Studies

In this section of the web we present you with practice projects.  Each challenge will have a stated objective, suggested components to work with, and a posted answer.  Work through all the challenges to reinforce the concepts for each respective video series.  Have fun.

VB 6.0 Fundamentals Challenges
Nugget Challenge #1: Beginner Coloring Fun [download answer]
Nugget Challenge #2: Intermediate Coloring Fun [download answer]
Nugget Challenge #3: Beginner Number Fun [download answer]
Nugget Challenge #4: Intermediate Number Fun [download answer]
...more to come

VB 6.0 Desktop Applications Challenges

Nugget Challenge #5: Beginner Architecture [download answer]
Nugget Challenge #6: Intermediate Architecture [download answer]
Nugget Challenge #7: Beginner Data Manipulation [download answer]
Nugget Challenge #8: Intermediate Data Manipulation [download answer]
...more to come

VB 6.0 Distributed Applications Challenges

Nugget Challenge #9: Beginner Tiers [download answer]
Nugget Challenge #10: Intermediate Tiers [download answer]
...more to come

Nugget Challenge #1: Beginner Coloring Fun

Overview:
The point of this challenge is to get you familiar with controls; how to manipulate textboxes, combo boxes, check boxes, command buttons and how to display friendly messages to users.

The Challenge:

  1. Create a mini-program to add colors into a combo box based on user input within a text box. 

  2. Display the selected color to a user when they click on a button. 

  3. Create a checkbox so that when the user chooses it, it turns the forecolor of the combo box and textbox to blue, if the user doesn't choose it, keep the text at the default color. 

  4. Finally, give your form a cool icon!

What you'll need:

  • 1 Form

  • 5 Command Buttons (Display Color, Clear Combo, Add Color, Clear Text, Exit)

  • 1 Combo Box

  • 1 Text Box

  • 1 Check Box

Hints:

  • Make sure the text box has something in it before adding the color, and if not, let the user know!

  • Make sure the combo box has something in it before displaying the color.

  • Make your combo a drop-down LIST, so users cannot type into it.


Screenshot:

back to top

Nugget Challenge #2: Intermediate Coloring Fun

Overview:
The point of this challenge is to get familiar with the programmer's mindset, by enhancing Nugget Challenge #1.  Ask yourself questions while designing your programs. For this one, questions below should come to mind:

  • What if the color is already in the list?

  • What if the user accidentally clicks on the clear combo button?

  • How can i make it convenient for the user to type in colors and hit enter, without ever using their mouse?

The Challenge:

  1. Enhance Nugget Challenge #1 by adding validation to make sure the color being added isn't already in the combo. 

  2. Give the user an "are you sure" message before emptying the contents of the combo.

  3. Clear and give the textbox focus after adding an item to the combo

  4. Determine which property to set so the user can hit enter on the keyboard to substitute for a button press?

What you'll need:

  • Nugget Challenge #1

Hints:

  • In order to check text against a combo box, you'll have to compare each combo item against the textbox text.

Screenshot:

back to top

Nugget Challenge #3: Beginner Number Fun

Overview:
The point of this challenge is to get you familiar with more controls; how to manipulate listboxes, textboxes, combo boxes, and validation.

The Challenge:

  1. Create a mini-program to add list items into a listbox based on a range typed into a text box. (*We want the user to have the ability to append a range to a list, or clear and re-add to the list. Also, we want the user to be able to choose multiple list items and click on a button that fills another listbox on another form with those selected items.) 
  2. See if you can display the selected items in a message box, clear the list box and clear our textboxes.

What you'll need:

  • 2 Forms
  • 5 Command Buttons (Build List, Clear Range, Build Selected List, Clear List, Exit)
  • 2 Listboxes (1 per form)
  • 2 Check Boxes (one for appending a range to a list, one for displaying the selected listitems in a message box.)

Hints:

  • Make sure the combo has a valid range typed in and is of numeric value.
  • Make sure the listboxes multiselect property is extended, meaning we can use control and shift to extend our selections.
  • Looping statements are our friends!

Screenshot:

back to top

Nugget Challenge #4: Intermediate Number Fun

Overview:
The point of this challenge is to get familiar with user friendly methodologies, by enhancing Nugget Challenge #3. Ask yourself more questions by putting yourself in the shoes of the users.

  • Instead of textboxes, should I use combo boxes so the user can choose a range instead of typing one in? (*This also makes it easier on us since our validation routines get smaller due to less checking.)
  • Would the user like a menu?
  • Display a label as a the selected count checkbox is checked and unchecked, instead of a messagebox causing the user an extra click.

The Challenge:

  1. Enhance Nugget Challenge #3 by morphing our textboxes into combo boxes and having a prebuilt range of 0-32000 in each combo
  2. Turn our messageboxes into labels and create a friendly menu for a nice centralized function area. 
  3. Display an hourglass when the user clicks on build list and when loading the application (the combo boxes take a bit to load).

What you'll need:

  • Nugget Challenge #3
  • An extra label above our listbox
  • A Menu

Hints:

  • Make sure our combo's low range isn't higher than the high range, or vice versa!

Screenshot:

back to top

Nugget Challenge #5 Beginner Architecture

Overview:
The point of this challenge is to get you familiar with a host of desktop application areas; from VB essentials to advanced controls to familiarity with COM components. We'll go "hands-on" with treeview controls, Status bars, COM components menus and much more.

The Challenge:
Create a mini-program to give a user the ability to add a house and a few of it's properties into a treeview control.

  1. The house itself will be constructed as a COM component.

  2. We also want the ability to delete homes from the treeview and 

  3. A status bar that will give the count of homes within in the tree.

What you'll need:
  • 1 Form

  • 1 Treeview

  • 1 Statusbar

  • 1 Imagelist

  • 2 Command Buttons (Build House, Reset Fields)

  • 1 Menu (File->Exit, Options->Delete Selected Home -> | ->Change Forecolors)

  • 2 Textboxes (Address, House Color)

  • 1 Combo Box (Rooms)

  • 2 Checkboxes (Garage?, Basement?)

Hints:
  • Construct your COM component based on the interfaces objects.

  • ie: Address textbox could be a Property Let/Get.

  • Build the house node into the treeview based on the properties within the COM component

  • Make sure an address is entered before adding the item into the treeview.

Screenshot:

back to top

Nugget Challenge #6 - Intermediate Architecture

Overview:
The point of this challenge is to get familiar with ADO recordsets and expand upon an application's functionality.  We also want to enhace our COM components.

The Challenge:

  1. Take Nugget Challenge #5 and morph it into a database application that saves and loads the treeview with data stored in a table

  2. Remove the menu functionality and all of it's code (don't forget, when you delete controls, the code doesnt go!), 

  3. Replace it with command buttons on the form.

What you'll need:

  • Nugget Challenge #5 - Beginning Architecture

  • 2 More command buttons

Hints:

  • Make sure to set a reference to ADO before using it.

Screenshot:

back to top

Nugget Challenge #7: Beginner Data Manipulation

Overview:
The point of this challenge is to work heavily with database access, more specifically ADO. We’re going to get familiar with multiple recordsets based on multiple tables.  We're going to work with recordsets intermingling with one another hosted and manipulated in the highly useful treeview and listview controls. We’ll be working with a good amount of data within the Northwinds sample database included with SQL Server.

The Challenge:

Create a mini-program that allows us to view all of the products within the appropriate category using the products and categories tables within the Northwinds database in SQL Server.

1.      Start by filling a treeview with all of the possible categories within the categories table.

2.      Select a category in the treeview and see all of the products within the Northwinds database that relate to that category and display them in a listview control.

3.      Select a product within the listview and get detailed inventory information for that product within another listview or a set of textboxes.

4.      Create category descriptions in a label whenever one is selected from the treeview.

What you'll need:

·         1 Form
·         1 Treeview
·         2 Listviews
·         1 Imagelist
·         1 Label
·         1 Command Button (Exit)

Hints:

  • Use a single connection within your form that is opened in form_load and closed in form_unload.

  • Use the custom property of the treeview and listview controls to set them up for the appropriate behavior.

  • Use the open method of the recordset object to submit your queries to the Northwinds database.

Screenshot:

back to top

Nugget Challenge #8: Intermediate Data Manipulation

Overview:
The point of this challenge is to dig deeper into ADO data access by enhancing what we’ve done with Nugget Challenge #7. Now we’re going to add the suppliers table, adding another layer of data. We will work with a great amount of data using powerful queries to look at information in a more detailed perspective than the previous nugget challenge.

The Challenge:

Enhance Nugget Challenge #7 by adding the suppliers above the category level in the treeview. This means we now want to see suppliers and underneath suppliers each category. That way when we select a category, we only get the products that supplier carries.

1.      We first have to wrap a layer above our category code to add suppliers and then the same categories underneath every supplier.

2.      When we select a category, we now need the program to grab only those items in that category for that specific supplier.

What you'll need:

·         Nugget Challenge #7 - Beginner Data Manipulation

Hints:

·         Give visual notification if no products exist for the selected suppliers category.
o        Think about using what we already have for the above, add an item in a listview 
	that says “No [category_name] for the [supplier_name].”
·         You’ll need to join 3 tables in one recordset to derive the appropriate data for our products!

Screenshot:

back to top

Nugget Challenge #9: Beginner Tiers

Overview:
The point of this challenge is to get you familiar with a host of distributed application areas; from two-tiered client -> database application programming to ADO and wrapping our database logic within COM components that efficiently utilize stored procedures and dynamic SQL statements. We'll go "hands-on" with stored procedures and work within the pubs testing database supplied by default with SQL Server.

The Challenge:

Create a mini-program that allows us to create, select and delete authors within the authors table in the pubs database.

1.      Fill a listview with all of the authors in the authors table using a stored procedure.

2.      From there, we should be able to select an author in the list to display his/her details in textboxes below.

3.      Add authors into the authors table using a stored procedure or dynamically built SQL statement.

4.      Validate the author id field to make sure it follows the appropriate structure: xx-xxx-xxxx where x is always numeric.

What you'll need:

·                1 Standard EXE
o        1 Form
o        1 Toolbar (Add, Save, Delete and Exit)
o        1 Listview
o        1 Imagelist
o        1 Frame
o        8 Textboxes to represent the fields within the authors table.
o        1 Checkbox to represent the Boolean bit field in the authors table.
·         1 ActiveX DLL
o        1 Class Module

Hints:

·         Use a single connection within our COM component that’s opened when our 
	component is instantiated, and closed when deinstantiated.
o        Return ADO recordsets from your functions, this way they’ll come 
	back disconnected from the client’s standpoint.
o        Use properties to represent field names within the authors database.
·         Use a command object to execute stored procedures or the connection object
	to execute dynamic SQL statements.
·         Remember validation on our AuthorID field, this has a constraint within the authors 
	database table.

Screenshot:

back to top

Nugget Challenge #10: Intermediate Tiers

Overview:
The point of this challenge is to get you familiar with some of the more advanced distributed concepts by taking challenge #9 and converting it into a 3 tier distributed application. We’ll take the COM component built in the previous challenge and enable it to participate in the MTS environment. Also, we’ll add 2 of the most commonly used API functions to get information from the client machine.

The Challenge:

Enhance Nugget Challenge #9 – Beginner Tiers to a three tiered distributed application where the methods within our COM components will be MTS enabled by adding the appropriate code to work with the ObjectContext object. Also, use the GetComputerName and GetUsername API to show the currently logged on user and the computer they are using displayed within some panels in a status bar.

1.      Add coding within our COM components method to support MTS transactions.
 
2.      Add a status bar to reflect the Username and Computer name of the currently logged in user.
 
3.      Create a package within MTS to host the compiled version of our COM DLL.

What you'll need:

·         Nugget Challenge #9 – Beginner Tier
·         1 Standard Module added to the Standard EXE project to host our API declarations.
·         1 Status Bar within our form.

Hints:

·         Don’t forget to add a reference to the MTS Transaction Server Type Library!
·         Create a package within MTS then add your component to the package.
·         Don’t forget to reference the component within MTS, not the project within 
	your project group!

Screenshot:

back to top
 
CBT Nuggets - IT Certification Training Videos
buy videos online fax/mailing order form contact us