Home

Application Online Help

 

Introduction

Providing help is one of the most neglected areas of application development. There are various reasons to this. Some programmers tend to think that help is such a small job that it should be left to non-programmers. This is not a valid argument since the person who creates an application knows it better than anybody. Asking someone else to create help for your application would only slow the process because the other person would need to have new and more information about the application. Another reason is that, most programmers who want to take care of programming when creating an application think that they are working double to create a single program. This drives them to set this aspect aside and continue only with the application, thinking that they can come back to take care of help when the application is complete. What makes this unrealistic is that, sometimes when they finish the application, they are "tired".

There are various small but effective techniques you can use to provide help in your application: never neglect help.

Practical LearningPractical Learning: Introducing Help

  1. Start Microsoft Visual C#
  2. Create a Windows Application named ClarksvilleIceCream1
  3. In the Properties window, change the form's Text to Clarksville Ice Cream
  4. Design the form as follows:
     
    Clarksville Ice Cream: Form Design
    Control Name Text Additional Properties
    GroupBox grpIceCream    
    Label   Order Date:  
    DateTimePicker dtpOrderDate   Format: Short
    Label   Order Time:  
    DateTimePicker dtpOrderTime   Format: Time
    ShowUpDown: True
    Label   Flavor:  
    ComboBox cboFlavors    
    Label   Container:  
    ComboBox cboContainers    
    Label   Ingredient:  
    ComboBox cboIngredients    
    Label   Scoops:  
    TextBox txtScoops 1 TextAlign: Right
    Label   Order Total:  
    TextBox txtOrderTotal 0.00 TextAlign: Right
    Button btnNewOrder New Order  
    Button btnCalcTotal Calculate Total  
    Button btnClose Close  
  5. Click the combo box to the right of the Flavor label. Then, in the Properties, click the ellipsis button Ellipsis of Items property and create the list with:
     
    Vanilla
    Cream of Cocoa
    Chocolate Chip
    Cherry Coke
    Butter Pecan
    Chocolate Cookie
    Chunky Butter
    Organic Strawberry
    Chocolate Brownies
    Caramel Au Lait
  6. Click OK
  7. Click the combo box to the right of the Container label. Then, in the Properties, click the ellipsis button Ellipsis of Items property and create the list with:
     
    Cone
    Cup
    Bowl
  8. Click OK
  9. Click the combo box to the right of the Ingredient label. Then, in the Properties, click the ellipsis button Ellipsis of Items property and create the list with:
     
    None
    Peanuts
    Mixed Nuts
    M & M
    Cookies
  10. Click OK
  11. Double-click the New Order button to access its Click event and implement it as follows:
     
    private void btnNewOrder_Click(object sender, EventArgs e)
    {
                // If the user clicks New Order, we reset the form with the default values
                this.dtpOrderDate.Value = DateTime.Today;
                this.dtpOrderTime.Value = DateTime.Now;
                this.cboFlavors.Text = "Vanilla";
                this.cboContainers.Text = "Cone";
                this.cboIngredients.Text  = "None";
                this.txtScoops.Text = "1";
                this.txtOrderTotal.Text = "0.00";
    }
  12. Return to the form
  13. Double-click the Calculate Total button to access its Click event
  14. Implement it as follows:
     
    private void btnCalcTotal_Click(object sender, EventArgs e)
    {
                double  PriceContainer = 0.00,
                       PriceIngredient = 0.00,
                       PriceScoops = 0.00,
                   OrderTotal = 0.00;
    	int NumberOfScoops     = 1;
    
    	// Find out what container the customer requested
        	// The price of a container depends on which one the customer selected
        	if( cboContainers.Text == "Cone" )
    		PriceContainer = 0.55;
        	else if( cboContainers.Text == "Cup" )
    		PriceContainer = 0.75;
        	else
    		PriceContainer = 1.15;
    
        	// If the customer selected an ingredient, which is not "None", add $.95
        	if( cboIngredients.Text != "None" )
    		PriceIngredient = 0.95;
            
        	try  {
    		// Get the number of scoops
    		NumberOfScoops = int.Parse(this.txtScoops.Text);
    
    		if( NumberOfScoops == 2 )
    			PriceScoops = 2.55;
    		else if( NumberOfScoops == 3 )
    			PriceScoops = 3.25;
    		else
    			PriceScoops = 1.85;
        	}
        	catch(FormatException)
        	{
    		MessageBox.Show("The value you entered for the scoops is not valid" +
    	              		"\nOnly natural numbers such as 1, 2, or 3 are allowed" +
    	                 	"\nPlease try again");
        	}
            
        	// Make sure the user selected a flavor, 
        	// otherwise, there is no reason to process an order
        	if( cboFlavors.Text != "" )
    		OrderTotal = PriceScoops + PriceContainer + PriceIngredient;
    
        	this.txtOrderTotal.Text = OrderTotal.ToString();
    }
  15. Return to the form
  16. Double-click the Close button and implement its Click event as follows:
     
    private void btnClose_Click(object sender, EventArgs e)
    {
                Close();
    }
  17. Test the application. Here is an example:
     
    Clarksville Ice Cream: Result
  18. Close the form and return to Visual Studio

Status Bar Messages

One way you can provide simple help consists of displaying short indicative messages on a status bar. To do this, you can first create sections, called panels, on a status bar and then display the necessary messages in the section of your choice. The message can be anything but it should consist of just a few words to fit in its section without going over board.

Practical LearningPractical Learning: Helping Through a Status Bar

  1. Display the from and expand its bottom border a little bit
  2. On the Toolbox, click StatusStrip and click the bottom section of the form
  3. In the Properties window, click Items and click its ellipsis button Ellipsis
  4. In the Select Item and Add to List Below combo box, select StatusLabel if necessary and click Add
    On the right side, set the Text to Ready
     
  5. Click OK
     
  6. On the form, click the dtpOrderDate control; that is, the combo box on the right side of the Order Date label
  7. In the Properties window, click the Events button and double-click MouseMove
  8. Return to the form
  9. In the same way, initiate the MouseMove event of the dtpOrderTime date time picker, the cboFlavors combo box, the cboContainers combo box, the cboIngredients combo box, the txtScoops text box, the txtOrderTotal text box, and the form
  10. Implement the events as follows:
     
    private void dtpOrderDate_MouseMove(object sender, MouseEventArgs e)
    {
        statusStrip1.Items[0].Text =
    	"Specify the date this order was processed";
    }
    
    private void dtpOrderTime_MouseMove(object sender, MouseEventArgs e)
    {
        statusStrip1.Items[0].Text =
    	"Specify the time this order was processed";
    }
    
    private void cboFlavors_MouseMove(object sender, MouseEventArgs e)
    {
        statusStrip1.Items[0].Text = "Select the customer's desired flavor";
    }
    
    private void cboContainers_MouseMove(object sender, MouseEventArgs e)
    {
        statusStrip1.Items[0].Text =
    	"Select the type of object that will contain the ice cream";
    }
    
    private void cboIngredients_MouseMove(object sender, MouseEventArgs e)
    {
        statusStrip1.Items[0].Text =
    	"Select an ingredient to spice the ice cream";
    }
    
    private void txtScoops_MouseMove(object sender, MouseEventArgs e)
    {
        statusStrip1.Items[0].Text =
    	"Select the number of scoops to fill the container";
    }
    
    private void txtOrderTotal_MouseMove(object sender, MouseEventArgs e)
    {
        statusStrip1.Items[0].Text =
    	"This displays the total of the order";
    }
  11. Return to the form and click a border of the group box
  12. In the Events section of the Properties, generate the event of the MouseHover field, and implement it as follows:
     
    private void grpIceCream_MouseHover(object sender, EventArgs e)
    {
        this.statusStrip1.Items[0].Text = "Ready";
    }
  13. Return to the form and click an area of its body away from any control on it
  14. In the Events section of the Properties, generate the event of the Move field, and implement it as follows:
     
    private void grpIceCream_MouseHover(object sender, EventArgs e)
    {
        this.statusStrip1.Items[0].Text = "Ready";
    }
  15. Test the application
     
  16. After using it, close the form and return to Visual Studio

Tool Tips

A tool tip is a small yellow box that displays a word or a group of words when the user positions the mouse on top of a control:

tool tip example

To create a tool tip system in a Visual Studio 2005 application, first add a ToolTip control to a form. After adding a ToolTip control, the form and all controls on it receive a new field in the Properties window. If the new ToolTip control is called ToolTip1, the new field in the Properties window for each control is ToolTip on ToolTip1. To display a tool tip for a control, first click it on the form. Then, in the Properties window, click ToolTip on ToolTip1, and type the desired tool tip.

Practical LearningPractical Learning: Adding Tool Tips

  1. To prepare for tool tips, on the Toolbox, click ToolTip ToolTip and click the form
  2. On the form, click each control and, in the Properties window, set its ToolTip On ToolTip property as follows:
     
    Control ToolTip On ToolTip1
    dtpOrderDate Click the arrow to select a date
    dtpOrderTime Click each section, then click one of the arrows to change its value
    cboFlavors Click the arrow to display a list, then select a flavor from the list
    cboContainers Click to display the list of containers and select one
    cboIngedients Display the list of ingredients and make the customer's choice
    txtScoops Enter the number of scoops (1, 2, or 3) to fill the container
    txtOrderTotal This displays the total amount of this order
    btnNewOrder Click here to reset the form
    btnCalcTotal Click here to calculate the total of the order
    btnClose Click here to Close the form
  3. Test the application
     
  4. Close it and return to Visual Studio
 

Home Copyright © 2007 FunctionX, Inc. Next