Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 3 - Adding Features to a Windows Forms Applica...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Adding Features to a Windows Forms Application
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating:  stars stars stars stars stars / 0
    2009-07-07

    Table of Contents:
  • Adding Features to a Windows Forms Application
  • How to add navigation features
  • The property settings for the Invoice Total form
  • How to name and save the files of a project
  • Perspective

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Adding Features to a Windows Forms Application - The property settings for the Invoice Total form


    (Page 3 of 5 )

    Figure 2-8 shows the property settings for the Invoice Total form. As you can see, you don’t need to change many properties to finish the design of this form. You only need to set four properties for the form, and you only use six of the properties (Name, Text, TextAlign, ReadOnly, TabStop, and TabIndex) for the controls. Depending on the order in which you create the controls, though, you may not need to change the TabIndex settings.

    Notice that the three text boxes that display the form’s calculation have their ReadOnly property set to True. This setting gives the text boxes a shaded appearance, as you saw in figure 2-3, and it prevents the user from entering text into these controls. In addition, the TabStop property for these text boxes has been set to False so the user can’t use the Tab key to move the focus onto these controls.

    Finally, the settings for the TabIndex properties of the text box and the two buttons are 1, 2, and 3. Since the label controls can’t receive the focus, and since the TabStop property for the three read-only text boxes has been set to False, the user can press the Tab key to move the focus from the Subtotal text box to the Calculate button to the Exit button.

    In addition, the Subtotal label has a TabIndex property of 0 and a Text property that includes an access key of S. As a result, the user can press Alt+S to move the focus to the control that has the next available tab index. In this case, that control is the Subtotal text box, which has a TabIndex property of 1.

    Of course, this is just one way that the TabIndex properties could be set. If, for example, the TabIndex properties for the 10 controls were set from 0 through 9, from top to bottom in this summary, the tab order would work the same.

    How to use Document Outline view

    Document Outline view is a feature that became available with Visual Studio 2005. To open the window for this view, you use the View->Other Windows->Document Outline command. This opens a window to the left of the Form Designer that lists the names of all of the controls that have been added to the current form.

    This view makes it easy to check whether you’ve named all of the controls that you’re going to refer to in your Visual Basic code. You can also select a control in the Form Designer by clicking on the name of the control in Document Outline view. Although these are minor benefits, it’s worth experimenting with this view to see whether you’re going to want to use it.

    The property settings for the form  

     

     

    Form1

    Text

    Invoice Total

     

    AcceptButton

    btnCalculate

     

    CancelButton

    btnExit

     

    StartPosition

    CenterScreen

     

     

    The property settings for the controls

     

     

    Default name Property Setting
    Label1 Text &Subtotal:
    TextAlign TabIndex MiddleLeft 0
    Label2 Text TextAlign Discount percent: MiddleLeft
    Label3 Text Discount amount:
     TextAlign MiddleLeft
    Label4 Text Total:
     TextAlign MiddleLeft
    TextBox1 Name txtSubtotal
     TabIndex 1
    TextBox2 Name txtDiscountPercent
     ReadOnly TabStop True False
    TextBox3 Name txtDiscountAmount
     ReadOnly TabStop True False
    TextBox4 Name txtTotal
     ReadOnly TabStop True False
    Button1 Name btnCalculate
     Text &Calculate
     TabIndex 2
    Button2 Name btnExit
     Text E&xit
     TabIndex 3

     

     

    Note

    • To provide an access key for the Subtotal text box, you can set the TabIndex and Text properties for the Subtotal label as shown above.

    Figure 2-8.  The property settings for the Invoice Total form

    More Visual Basic.NET Articles
    More By Murach Publishing


     

    Buy this book now. This article is excerpted from chapter two of Murach's Visual Basic 2008, written by Anne Boehm (Murach, 2008; ISBN: 1890774456). Check it out today at your favorite bookstore. Buy this book now.

    VISUAL BASIC.NET ARTICLES

    - Clocks and Countdowns
    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek