Title: Visual Basic.NET Programming (CT-228)
1Visual Basic.NET Programming (CT-228)
2Visual Basic.NET (CT-228)
- Chip Schopp
- Phone (978) 779-6544
- Email chipschopp_at_comcast.net
- Web Site www.pondviewsoftware.com
- Continuing Education Office
- Phone (603) 577-6500
- Fax (603) 577-6503
- Â
3Course Dates and Time
- This class meets every
- Wednesday evening
- from 530 pm until 1030 pm
- January 14th through March 3rdÂ
4Text
- Programming Visual Basic .NET, 2nd Edition
- by Jesse Liberty,
- Published by O'Reilly Associates, Inc,
- ISBN 0-596-00438-9. Â
5Course Materials
- Presentations
- Class Exercises
- Homework Assignments
- www.pondviewsoftware.com
- or
- www.pondviewsoftware.com/visualbasicclass.htm
- Â
6Prerequisite
- Fundamental of Programming
- (CT100)
- or
- by permission of the instructor.
7Course Description
- This course will introduce students to the
Microsoft Visual Basic.NET programming language
with significant emphasize on developing
programming skills. - Each student will write at least sixteen
programs, some in class and some as homework. - Â
8Class Goals
- Be able to write, test, and debug windows desktop
and web-based programs using Visual Basic.NET and
the Visual Studio.NET IDE. - Be able to use many Visual Basic.NET language
components to write programs. - Understand how a VB.NET application fits into the
.NET Framework. - Be able to use many Windows and Web controls to
implement forms based applications. - Be able to read and write sequential ASCII text
files, as well as, manipulating data files and
Windows directory trees.
9Class Goals (continued)
- Be able to use ADO.NET to interact with a
Microsoft Access database. - Know how to deploy try, catch, finally exception
processing. - Be able to create and work with simple and
complex types, objects and classes. - Have a basic understanding of object technology
and object oriented application development. - Have written a basic web service and will
understand the basic components and additional
complexities of developing a distributed
web-based applications.
10Class Goals (continued)
- Will work with a number of method attributes such
as WebMethod, Serializable, Synchronization,
Locking, etc. - Some exposure to advanced subject like
multi-threaded applications, tree controls,
remoting, etc.
11Course Notes
- While students will write a simple windows
console application using a text editor the
course will primarily focus on programming
windows desktop and web based applications using
the Visual Studio.NET IDE (Interactive
Development Environment). - Â
12Course Notes (cont)
- The course will use Visual Basic.NET, version
1.0, although the student will still be able to
complete the class using the new released version
of Visual Basic.NET 2003, version 1.1. - Â
13Course Notes (cont)
- Each class will open with a time for questions
and answers. Questions from a previous class or
questions emailed to the instructor will be
addressed. Other questions will either be
answered or captured for a future response.
Questions should be as specific as possible. - Â
- The only dumb questions are the ones not asked!
14Class Schedule
January 14, 2004 Introduction Basic Console App Basic Console App with IDE Windows Form App
January 21, 2004 Windows Form Programming
January 28, 2004 Windows Form Programming
February 4, 2004 Types, Classes, Objects
February 11, 2004 Files and Databases (ADO.NET)
February 18, 2004 Web Forms
February 25, 2004 Web Services/Class Project
March 3, 2004 Web Services/Class Project
15The instructor reserves the right to modify the
schedule as needed.
16Effective Learning
- First is Doing
- Class exercises
- Coaching
- Helping each other
- Homework
- Second is Discussing
- Class discussions
- Asking questions
- Sharing ideas and information
- Last is Listening
17You have my permission, if what I'm doing is
boring or just not working, let me know and we'll
try something different.
18Class Attendance
- Class attendance is important.
- While missing a class is sometimes unavoidable,
it can put you behind for the rest of the course. - Class Material tends to build on prior lessons.
- All class material is available on the web.
- Â
19Grades
- Average of Homework Assignments (probably seven)
and a Web Services Class Project. - I tend to grade by developing a grade matrix for
an assignment and then assigning grades based on
completeness, so please follow the directions.
20Late Homework
- While late homework is sometimes unavoidable, but
my experience is that it comes with a price. - Â
- While incompletes are allowed with prior approval
of the instructor they are clearly not a good
idea. - Â
21Every attempt will be made to provide each
student with a level of instruction and material
able to insure a successful learning
experience.If you are having any difficulty
with the material or the instructor please
contact the instructor or the Office of
Continuing Education for assistance.
22Your Introductions
- A bit about yourself, why you are here
- Your programming background (operating systems,
languages, ?) - Any exposure to .NET ? Other .NET courses ?
- Your expectations for this course
23Tonight ? HelloWorld in three flavors
- Creating a Visual Basic.NET program without using
Visual Studio.NET (use Notepad instead) - Writing a console Hello World using the IDE
(Integrated Development Environment) ? Visual
Studio.NET - Writing a Windows Form Hello World using Visual
Studio.NET
24Creating a Visual Basic.NET program without using
Visual Studio.NET
25Steps to Creating a Non-Visual Studio.NET Program
- Open a Command (MSDOS) Window in the target
directory - Select or create a directory to work in
- Use Notepad (or someother text editor) to write
the code and save it in the target directory - Run an Frameworks SDK provided batch file to
setup the environment - Compile your program
- Correct any errors
- Execute your program
26Step 1 - Open a Command (MSDOS) Window in the
target directory
- Under the start menu
- Programs ? Accessories ? Command Prompt
27Step 2 - Select or create a directory to work in
- Open a Command Window
- C\Documents and Settings\Chipgtcd k\
- K\gtmkdir VBClassConsoleApp or whatever...
- K\gtcd VBClassConsoleApp
28Step 3 - Use Notepad (or some other text editor)
to write the code and save it in the target
directory
- Enter the following code
- Module HelloWorld
- Sub Main() System.Console.WriteLine("Hello
World") - End Sub
- End Module
- Save the file it in the target directory with the
name followed HelloWorld.vb
29Step 4 - Run an Frameworks SDK provided batch
file to setup the environment
- Microsoft Provides Several Batch Files to Set Up
a Command Window Environment for the .NET
Frameworks SDK - vsvars32.bat (..SDK\Common7\Tools\..)
- corvars.bat (..FrameworkSDK\Bin\..) for Version
1.0 - sdkvars.bat (..SDK\V1.1\Bin\..) for Version 1.1
- Probably the easiest way to do this is to copy
the file to your target directory and then
execute it (i.e. type filename and hit return) in
the Command window.
30Step 5 - Compile your program
- Within the command window
- Type vbc program name
- K\VBClassConsoleAppgt vbc HelloWorld.vb
31Step 6 - Correct any errors
- Identify the error
- Return to the Notepad window and correct the code
- Save the program
- Try Step 5 again
32Step 7 - Execute your program
- Within the command window
- Type the program name
-
- K\VBClassConsoleAppgt HelloWorld (.exe is
optional) - You should see something like this
- K\VBClassConsoleAppgt HelloWorld
- Hello World
- K\VBClassConsoleAppgt
33A Few Comments About the Code
- Module HelloWorld
- Sub Main() System.Console.WriteLine("Hello
World") - End Sub
- End Module
- Module and matching End Module
- Sub or Function (functions return a value) and
End Sub - Method called main (every console application
includes a main method)
34System.Console.WriteLine("Hello World")
- System is the Namespace
- Can be nested
- System.Windows.Forms
- Namespace can be referenced using an Imports
statement - Console is the Class in the Namespace
- WriteLine is a method in the class
35Try Using the Imports Statement
- Two Differences in this Code
- Addition of the Imports Statement
- Remove of the System before Console
- Imports System
- Module HelloWorld
- Sub Main()
- Console.WriteLine("Hello World")
- End Sub
- End Module
36(No Transcript)
37Writing a console Hello World using the IDE
(Integrated Development Environment) ? Visual
Studio.NET
38Click on Microsoft Visual Studio.NET
39Click on File?New?Project
40- Select Visual Basic Projects as your development
language - Select Console Application as your project type
- Use the Browse button to select a target
directory for this project - Name the project (whatever you like)
- Click OK
41(No Transcript)
42You Should See This
43- Expand the References on the Right
- Note the System reference is provided
automatically
44Add the following code
- Module Module1
- Sub Main()
- Console.WriteLine("HelloWorld")
- End Sub
- End Module
- Note the absense of the System.Console.
45Notice the Intellisense for Console
46- Click on Build ? Build Solution
- Look for the Build Results in the Output window
47- Build the application again
- Check for Errors
- Test it Debug ? Start Without Debugging (try just
Start)
48(No Transcript)