Chapter 4
Chapter 4
Advanced Programming with event driven particularly if you need to manipulate a lot of controls all at
the same time.
4.1.Debugging Your Applications
Sample code
Debugging is the process of running our code step by step in a
debugger and identifying, analyzing, and removing errors (also
known as “bugs”) from our code.
private void button3_Click(object sender, EventArgs e) Help system, enables the user to turn for assistance in times of
{
confusion.
// Initializing a list for control array called check
check = new CheckBox[] { checkBox1, checkBox2, checkBox3,
checkBox4 }; The .NET framework offers the Help class and the HelpProvider
Creating a Simple Web Page The default system browser opens and displays the application
running. Many web applications require users to create an
Create a new Web project by selecting File ➪ New ➪ Project
account before they can use certain features of the site. Visual
within Visual Studio. In the New Project dialog, select the
Web Developer automatically includes Login and Register
category Visual C# and the subcategory Web, and then select the
controls. Try logging in or create a new user.
ASP.NET Empty Web Application template. Name the project
EventRegistrationWeb. Close your browser and return to Visual Web Developer. For the
first user registered with the website, Visual Web developer
After creating the Web project, create a new Web page using the
automatically creates a SQL Server 2008 Express Edition
menu Project ➪ Add New Item, select the Web Form template,
database named ASPNETDB in the App_Data folder with
and name it Registration.aspx.
predesigned tables to support user accounts.
Pay attention to the directory where you store the project. The
To verify this, right--‐click on the App_Data folder in the
project should be in C:\Users\Public\...name it WebsiteExample,
Solution Explorer window and select Refresh Folder shown in
or any other name you like.
above right-side image. Expand App_Data by clicking on the
Visual Web developer creates a skeleton .aspx file named plus sign. You will see the database file ASPNETDB.MDF used
Default.aspx. This file contains only static code, but we will
by your website. By default, it includes 11 tables, providing A Simple HTML Document
functionality that extends beyond simple user accounts.
<!DOCTYPE html>
<html>
What is HTML?
<head>
<title>Page Title</title>
HTML is a format that tells a computer how to display a web </head>
page. The documents themselves are plain text files with special <body>
<h1>My First Heading</h1>
"tags" or codes that a web browser uses to interpret and display <p>My first paragraph. </p>
information on your computer screen. HTML is the standard </body>
</html>
markup language for creating Web pages.
HTML tags are element names surrounded by angle brackets: An ordered list is also a list of items. The list items are marked
with numbers. An ordered list starts with the <ol> tag. Each list
<tagname>content goes here...</tagname>
item starts with the <li> tag.
• HTML tags normally come in pairs like <p> and </p>
Inside a list item you can put paragraphs, line breaks, images,
• The first tag in a pair is the start tag, the second tag is
links, other lists, etc.
the end tag
• The end tag is written like the start tag, but with a HTML Links
forward slash inserted before the tag name
HTML uses the <a> anchor tag to create a link to another
The start tag is also called the opening tag, and the end tag the document or web page.
closing tag.
The Anchor Tag and the Href Attribute
Headings: Headings are defined with the <h1> to <h6> tags.
An anchor can point to any resource on the Web: an HTML
<h1> defines the largest heading while <h6> defines the
page, an image, a sound file, a movie, etc. The syntax of creating
smallest.
an anchor:
HTML Lists: HTML provides a simple way to show unordered
<a href="url">Text to be displayed</a>
lists (bullet lists) or ordered lists (numbered lists).
The <a> tag is used to create an anchor to link from, the href
Unordered Lists: An unordered list is a list of items marked
attribute is used to tell the address of the document or page we
with bullets (typically small black circles). An unordered list
are linking to, and the words between the open and close of the
starts with the <ul> tag. Each list item starts with the <li> tag.
anchor tag will be displayed as a hyperlink.