WebmasterForums.NET - Webmaster Forums & Directory
 

Go Back   WebmasterForums.NET - Webmaster Forums & Directory > Design and Development > Site Programming and Coding
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Site Programming and Coding Have a problem with some code on your site? Ask our other members for advice and help.

Reply
 
Thread Tools Display Modes
Old 07-25-2006, 08:06 PM   #1
Darioush
Member
 
Darioush's Avatar
 
Join Date: Jul 2006
Location: Sunny California
Posts: 53
Darioush is on a distinguished road
Default Coding Skills for a Windows Form Application

If you want to learn how to code and test a Windows form application, look no further. This article, the second of three parts, helps you brush up your coding skills. It is excerpted from chapter three of the book Murach's C# 2005, written by Joel Murach (Murach, 2005; ISBN: 9781890774370).

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-6, for example, you can see the lines under txtPercent and txtAmount.
If you place the mouse pointer over the code in error, a brief description of the error is displayed. In this case, the error message indicates that the name does not exist. That’s because the names entered in the Code Editor don’t match the names used by the Form Designer. If the names are correct in the Form Designer, you can easily correct these errors, by editing the names in the Code Editor. In this figure, for example, the names of the text boxes should be txtDiscountPercent and txtDiscountAmount.
If the Error List window is open as shown in this figure, any errors that Visual Studio detects will also be displayed in that window. If the Error List window isn’t open, you can display it by pointing to the Error List tab that’s displayed on the lower edge of Visual Studio. Then, you can jump to the error in the Code Editor by double-clicking on it in the Error List window.
When you’re first getting started with C#, you will inevitably encounter a lot of errors. As a result, you may want to use the Auto Hide button that’s available from the Error List window to keep it open all the time. This makes it easy to see errors as soon as they occur. Then, once you get the hang of working with C#, 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. Instead, 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
  • Visual Studio checks the syntax of your C# 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.
  • 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.
  • If the Error List window isn’t open, you can display it by selecting the Error List command from the View menu. Then, you can click the Error List tab that’s displayed at the edge of the Visual Studio window. If you prefer, you can click its Auto Hide button to keep it displayed.
  • 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.
More coding skills

At this point, you should understand the mechanics of adding code to a form. To code effectively, however, you’ll need some additional skills. The topics that follow present some of the most useful coding skills.

http://www.aspfree.com/c/a/C-Sharp/C...m-Application/
__________________
Napa Valley wine, wineries, on-line wine sales, lodging, vacations, golf, current events http://www.napavalley.com
Darioush is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 11:45 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
WebmasterForums.NET - Webmaster Forums & Directory