Visual Basic.NET
  Home arrow Visual Basic.NET arrow Correcting Code in 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

Correcting Code in a Windows Forms Application
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-07-13

    Table of Contents:
  • Correcting Code in a Windows Forms Application
  • Other skills for working with code
  • How to use code snippets
  • How to rename identifiers

  • 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


    Correcting Code in a Windows Forms Application


    (Page 1 of 4 )

    Welcome to the third part of a five-part article series on how to code and test a Windows Forms application. In this article you will learn a number of useful ways to deal with code, such as how to correct syntax errors, how to use code snippets, and so forth. This article is excerpted from chapter three of Murach's Visual Basic 2008, written by Anne Boehm (Murach, 2008; ISBN: 1890774456).

    How to detect and correct syntax errors

    As you enter code, Visual Studio checks the syntax of each statement. If a syntax error, or build error, is detected, Visual Studio displays a wavy line under the code in the Code Editor. In the Code Editor in figure 3-9, for example, you can see wavy lines under three different portions of code. Then, if you place the mouse pointer over one of the errors, Visual Basic will display a description of the error.

    If the Error List window is open as shown in this figure, any errors that Visual Studio detects are also displayed in that window. Then, you can double-click on an error message to jump to the related code in the Code Editor. After you correct a coding problem, its message is removed from the Error List window.

    If the Error List window isn’t open, you can display it by selecting the Error List command from the View menu. When you’re learning Visual Basic, you’re going to make a lot of coding errors, so it makes sense to keep this window open. But after you get used to Visual Basic, you can conserve screen space by using the Auto Hide button so this window is only displayed when you point to the Error List tab.

    By the way, Visual Studio isn’t able to detect all syntax errors as you enter code. So some syntax errors aren’t detected until the project is built. You’ll learn more about building projects later in this chapter.

    The Code Editor and Error List windows with syntax errors displayed

    Description

    1. Visual Studio checks the syntax of your Visual Basic code as you enter it. If a syntax error (or build error) is detected, it’s highlighted with a wavy underline in the Code Editor, and you can place the mouse pointer over it to display a description of the error.
    2. If the Error List window is open, all of the build errors are listed in that window. Then, you can double-click on any error in the list to take you to its location in the Code Editor. When you correct the error, it’s removed from the error list. 
       
    3. If the Error List window isn’t open, you can display it by selecting the Error List command from the View menu. 
       
    4. Visual Studio doesn’t detect some syntax errors until the project is built. As a result, you may encounter more syntax errors when you build and run the project.

     

    Figure 3-9.   How to detect and correct syntax errors

    More Visual Basic.NET Articles
    More By Murach Publishing


       · Komodo Edit is the best free Windows editor hands down. I had used Notepad++ for the...
     

    Buy this book now. This article is excerpted from chapter three 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

    - 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...
    - Movement and Player Statistics in a VB.NET T...





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