480 likes | 583 Views
Visual Basic.NET Programming (CT-228). Visual Basic.NET (CT-228). Chip Schopp Phone: (978) 779-6544 Email: chipschopp@comcast.net Web Site: www.pondviewsoftware.com Continuing Education Office Phone (603) 577-6500 Fax: (603) 577-6503 . Course Dates and Time. This class meets every
E N D
Visual Basic.NET (CT-228) Chip Schopp Phone: (978) 779-6544 Email: chipschopp@comcast.net Web Site: www.pondviewsoftware.com Continuing Education Office Phone (603) 577-6500 Fax: (603) 577-6503
Course Dates and Time This class meets every Wednesday evening from 5:30 pm until 10:30 pm January 14th through March 3rd
Text Programming Visual Basic .NET, 2nd Edition by Jesse Liberty, Published by O'Reilly & Associates, Inc, ISBN 0-596-00438-9.
Course Materials Presentations Class Exercises Homework Assignments www.pondviewsoftware.com or www.pondviewsoftware.com/visualbasicclass.htm
Prerequisite Fundamental of Programming (CT100) or by permission of the instructor.
Course 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.
Class 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.
Class 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.
Class 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.
Course 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).
Course 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.
Course 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!
The instructor reserves the right to modify the schedule as needed.
Effective 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
You have my permission, if what I'm doing is boring or just not working, let me know and we'll try something different.
Class 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.
Grades 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.
Late 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.
Every 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.
Your 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
Tonight 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
Creating a Visual Basic.NET program without using Visual Studio.NET
Steps 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
Step 1 - Open a Command (MSDOS) Window in the target directory • Under the start menu: Programs Accessories Command Prompt
Step 2 - Select or create a directory to work in • Open a Command Window • C:\Documents and Settings\Chip>cd k:\ • K:\>mkdir VBClassConsoleApp or whatever... • K:\>cd VBClassConsoleApp
Step 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
Step 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.
Step 5 - Compile your program • Within the command window • Type vbc program name K:\VBClassConsoleApp> vbc HelloWorld.vb
Step 6 - Correct any errors • Identify the error • Return to the Notepad window and correct the code • Save the program • Try Step 5 again
Step 7 - Execute your program • Within the command window • Type the program name K:\VBClassConsoleApp> HelloWorld (.exe is optional) • You should see something like this K:\VBClassConsoleApp> HelloWorld Hello World K:\VBClassConsoleApp>
A 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)
System.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
Try 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
Writing a console Hello World using the IDE (Integrated Development Environment) Visual Studio.NET
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
Expand the References on the Right • Note the System reference is provided automatically
Add the following code Module Module1 Sub Main() Console.WriteLine("HelloWorld") End Sub End Module • Note the absense of the System.Console.
Click on Build Build Solution • Look for the Build Results in the Output window
Build the application again • Check for Errors • Test it Debug Start Without Debugging (try just Start)