C#
  Home arrow C# arrow Page 4 - Coding Skills for a Windows Form Applicati...
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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? 
C#

Coding Skills for a Windows Form Application
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2006-06-29

    Table of Contents:
  • Coding Skills for a Windows Form Application
  • How to code with a readable style
  • How to code comments
  • How to work with the Text Editor toolbar
  • How to use code snippets

  • 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


    Coding Skills for a Windows Form Application - How to work with the Text Editor toolbar


    (Page 4 of 5 )


     
    Figure 3-9 shows how you can use the Text Editor toolbar to work with code. If you experiment with this toolbar, you’ll find that its buttons provide some useful functions for working with comments and indentation and for moving from one place to another.

    In particular, you can use the Text Editor toolbar to modify several lines of code at once. For example, during testing, you can use this toolbar to comment out several lines of code by selecting the lines of code and then clicking on the Comment button. Then, you can test the program without those lines of code. If necessary, you can use the Uncomment button to restore those lines of code. Similarly, you can use the Increase Indent and Decrease Indent buttons to adjust the indentation for selected lines of code.

    You can also use the Text Editor toolbar to work with bookmarks. After you use the Toggle Bookmark button to mark lines of code, you can easily move between the marked lines of code by using the Next and Previous buttons. Although you usually don’t need bookmarks when you’re working with simple applications like the one shown here, bookmarks can be helpful when you’re working with applications that contain more than a few pages of code.

    If you experiment with the other buttons on the Text Editor toolbar, you’ll find that they provide IntelliSense features like the ones you learned about earlier in this chapter for referring to properties, methods, and events. You can use these buttons to force Visual Studio to display a member list or information about a member that’s displayed in the Code Editor.

    How to collapse or expand blocks of code
     
    As you write the code for an application, you may want to collapse or expand some of the regions, comments, and methods to make it easier to scroll through the code and locate specific sections of code. To do that, you can use the techniques described in figure 3-9. In this figure, for example, the frmInvoiceTotal method has been collapsed so all you can see is its method declaration.

    You may also want to collapse or expand code before you print it. Then, in the dialog box for the File->Print command, you can check or uncheck the Hide Collapsed Regions box. If this box is checked, Visual Studio will only print the code that’s displayed in the Code Editor.

    The Code Editor and the Text Editor toolbar


    Figure 3-9.  How to use the Text Editor toolbar and collapse or expand code

    How to use the buttons of the Text Editor toolbar

    • To display or hide the Text Editor toolbar, right-click in the toolbar area and choose Text Editor from the shortcut menu.
    • To comment or uncomment several lines of code, select the lines and click the Comment or Uncomment button. During testing, you can comment out coding lines so they won’t be executed. That way, you can test new statements without deleting the old statements.
    • To increase or decrease the indentation of several lines of code, select the lines and click the Increase Indent or Decrease Indent button. Or, press the Tab and Shift+Tab keys.
    • To move quickly between lines of code, you can use the last eight buttons on the Text Editor toolbar to set and move between bookmarks.

    How to collapse or expand regions of code

    • If a region of code appears in the Code Editor with a minus sign (-) next to it, you can click the minus sign to collapse the region so just the first line is displayed.
    • If a region of code appears in the Code Editor with a plus sign (+) next to it, you can click the plus sign to expand the region so all of it is displayed.

    More C# Articles
    More By Murach Publishing


       · This article is an excerpt from the book "Murach's C# 2005," published by Murach. We...
     

    Buy this book now. This article is excerpted from chapter three of the book Murach's C# 2005, written by Joel Murach (Murach, 2005; ISBN: 9781890774370). Check it out today at your favorite bookstore. Buy this book now.

    C# ARTICLES

    - C# and XML
    - Pointers and Arrays in C#
    - C# 3.0 Extension Methods
    - Overloading Operators in C#
    - Iterators and Nullable Types
    - Patterns and Iterators in C#
    - C# Exceptions
    - Methods in C#
    - Delegates and Events in C#
    - Advanced C#
    - Working with Regular Expressions in C#
    - Sending Simple E-Mail in C#
    - Building C# Comparable Objects: IComparable ...
    - Color Transformation Applications in C# GDI+...
    - Performing Color Transformation Operations i...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT