Tuesday, August 28, 2007

Programming Exercise 8: Windows Forms 4

Instruction: Submit this exercise on September 10, Monday. Compress the whole project located at "My Documents Path\Visual Studio 2005\Projects\Project Name" (default) or at the location you specified. Upload this file to ELMS.

In preparation for your finals, you will be creating an application that will serve as the prototype for your final project. Although not fully functional, your application should implement these minimum requirements:
  • The application starts with a login form that will perform user validation. If the entered username and password are valid, load the main application form. If not, display an error. If the user clicks the Cancel button, the application should terminate. Since the application is not yet capable of storing data to a persistent storage, validate using "guest" as username and password for the meantime.
  • The application should also integrate your existing User Manager application. The User Manager form can be loaded when clicking the System -> Maintenance -> System Users menu item in the main application form.
  • The main application form should contain menu items similar to the sample given, i.e. it should have the following menus:
    • System - contains all menu items related to performing system functions
      • Maintenance - contains menu items related to configuring system-wide settings like system users and role assignments.
      • Masterfile - contains menu items related to configuring system-wide settings like lookup values used in transactions. An example of a menu item is "Loan Type" for a Loans Management System. Replace this with masterfiles related to your proposed system.
      • Exit - prompts a message confirming if the user wishes to close the application.
    • Transaction - contains all menu items related to performing system transactions. An example of a menu item is "Loan Application" for a Loans Management System. Replace this with transactions related to your proposed system.
    • Report - contains all menu items related to creating reports. An example of a menu item is "Loan Summary Report" for a Loans Management System. Replace this with reports related to your proposed system.
  • Create a System Configuration form similar to the sample given. This form does not need to implement any functionality yet and is reserved for future exercises.

The application should also integrate your existing User Manager application. The User Manager form can be loaded when clicking the System -> Maintenance -> System Users menu item in the main application form.
Hints: In addition to the existing controls you've used, this application also uses the following controls:
  • MenuStrip
  • StatusStrip
  • ListBox
  • TabControl
  • ComboBox
For the main application form, research on creating MDI forms.

You can download a sample output here.

Sample Code and Slide: Regular Expressions

This sample demonstrates using regular expressions for matching patterns in a string, which can be used to perform form data validation. This also uses a listbox form control for displaying results.

Download Code
Download Powerpoint Presentation

Wednesday, August 15, 2007

Programming Exercise 7: Windows Forms 3

This exercise is due on August 22, Wednesday. Compress the whole project located at "My Documents Path\Visual Studio 2005\Projects\Project Name" and upload it to ELMS.

Continuing from exercise #6, update your User Management application to support the following operations:

  • Edit a User record
  • Delete a User record
The application should have these additional buttons:
  • Edit - enables all textboxes (except the current index) for editing
  • Delete - deletes the current User record from the list
The functionality of these existing buttons should also be updated:
  • Save - if in edit mode, updates the current User record using values from the textboxes
  • Cancel - if in edit mode, disables all textboxes without updating the current User record
You can download the updated sample output here.

Hint: Use the ArrayList class for storing values as this array can be dynamically resized.

Wednesday, August 8, 2007

Programming Exercise 6: Windows Forms 2

Continuing from exercise #5, create a User Management application that maintains a list of User records. The application should support the following operations:
  • Add a new User record
  • Navigate through the list
The application should contain the following buttons:
  • Prev - moves to the previous User record
  • Next - moves to the next User record
  • New - clears and enables all textboxes for record entry
  • Save - adds a new User record to the list
  • Cancel - clears and disables all textboxes without adding a User record to the list
Upon application startup, all form controls (textboxes and buttons) except the New button are disabled. When the New button is clicked, the Save and Cancel buttons, as well as textboxes except the current index, are enabled. Clicking on the Save button will create a User record with values based on the values entered in the textboxes. This new record will be added to the list.

If there are already records in the list, the application should allow navigation through the Prev and Next buttons. The current index textbox should also be updated based on the record's index in the list. If the current index is 0, the Prev button is disabled. If the current index is equal to the number of records in the list, the Next button is disabled.

You can download the sample output here.

Sample Code: Forms (Properties)

This sample demonstrates using some of the properties of the Form controls to control the application's behavior. This also demonstrates the use of classes to pass data between forms, accessible through a property.

Download Code

Wednesday, August 1, 2007

Programming Exercise 5: Windows Forms

Create a windows application that allows a user to input the following in a Windows form titled 'Add User':
  • User ID
  • Password
  • First Name
  • Last Name
  • E-mail Address
The application should also contain two buttons: "Add" and "Clear". Clicking on the "Add" button will display all the entered fields on a separate Windows form. The displayed text should follow this format:
  • User ID : UserID
  • Password: Password
  • First Name: First Name
  • Last Name: Last Name
  • E-mail Address: E-mail Address
Hint: You can use the MessageBox class for this purpose.

Clicking on the "Clear" button clears all fields.

Here's a screenshot on how the application will look like:

Sample Code: Forms (Label, TextBox and Button)

This sample demonstrates the use of Label, Text and Button controls in a Windows Application. It also uses the MessageBox class for displaying messages in a separate Windows Form.

Download Code