CSCI 207 - Programming in Visual Basic

Syllabus  Sample Programs

Class Date: 1st Half of Class: 2nd Half of Class:

8/27 → 8/31

Chapter 1-Introduction to Computers and Problem Solving & Other Information about the course

  • Take Role & 1st day attendance
  • What is Programming?
  • What is a compiler?
    • Visual Studio Express Edition
    • Installing it
  • File management / Windows Explorer - Very Important!!!
  • Applied Technology minor
  • Getting started with our 1st VB Program
  • Importance of truly understanding the first few chapters
    • Terms
    • Don't underestimate the importance of knowing where you saved your program
    • Using the compiler
    • AWA - Alternate work assignments
    • Designing a Program (Software Engineering)
    • What is an algorithm?
    • Flowcharts & Pseudocode
    • More notes



 Link to download Visual Basic and some other tools.

Start our first walk-through VB program.

Writing your first Visual Basic Project

  1. Set up workspace
  2. Start new project
  3. Set up Environment
  4. Plan
  5. Place Controls on Form
  6. Set Properties
  7. Write Code
  8. Run
  9. Save & re-open
  10. Modify
  11. Do the Walkthroughs in chapter 2: p. 23
    1. Text Box
    2. Button
    3. Label
    4. List Box


If there's time start the Temperature Conversion Program.

9/3 → 9/7

Chapter 2 - Visual Basic Controls and Events
(Most of these notes are hands on stuff so I'll do a demo in class and probably go through these quicker than usual)

  • Controls and Events
  • Make sure you read this chapter carefully it covers fundamentals that are the building blocks of everything else.

I'll go over an example of a small program.

I Need Some Volunteers for a Study!!!!!

  • Make a game in a program called Thinking Worlds
  • Not too much effort or time required, like a couple hours or so a week (up to 6 months, maybe less)
  • Gift card or your choice (like amazon?)



 Do some exampes in Class,

In-Class project, try #4 page 100, Conversion program. Or something from that list of exercises.

9/10 → 9/14

Chapter 3 - Variables, Input, and Output

What is Critical Thinking?
Blooms Taxonomy

Start the Hands-On Programming Example

- Very important chapter
- Talk about strings
- Bring in Questions!!

Continue with the Hands-On example

In-class example :Compound Interest

A = P\left(1 + \frac{r}{n}\right)^{nt}
  • A = final amount
  • P = principal amount (initial investment)
  • r = annual nominal interest rate (as a decimal)
  • n = number of times the interest is compounded per year
  • t = number of years

Maybe to # 3 Page 155 in class as a continuation of this project.

9/17 → 9/21

Chapter 4 - Decisions

  • If Statements
  • Case Statement
  • Boolean Math
  • Calling other event functions
  • Making one function handle more than one event

Let's try a problem requiring a decision in class:

9/24 → 9/28

Chapter 5 - General Procedures

  • Sub Procedures
  • Function Procedures



Image Consulting Example


Review for Exam


Piece Work Calculator

Exam 1 - 9/28

Will be on:

  • Chapters 1 thru 5
  • If Statement
  • Functions
  • Procedures
  • Boolean
  • Case Statement




10/1 → 10/5

Go over the exam

Chapter 6 - Repetition 

 - Loops
 - Do While
 - Do Until
 - For - Next Loops

Let's start a project today that will use loops for your take home project next week:

We'll write a program to run a linear regression using least-squares:

What is that?  This is a way to predict or model data where it is thought that one variable effects the other. (Independent variable → dependent variable)

This is done by taking known pairs of data where is looks at though there is a correlation and applying it to a clalculation.

Write a program where the users enters in two pieces of data (paired) into a list box per line separated by a comma. (You can change this if you want; may be easier to have 2 list boxes)  Grab that data and run the least-squares approximation formula. 

Formula: (see below because this box is too small)

Ok, so you all know that a straight line uses the form y=mx+b where m is the slope and b is the y-intercept.

You are going to use the formula below to get the m and b

Then provide some input for the independent variable (m) and you tell the user y.  Y will be the predicted correlated value for m.

For example, If I gave you 30 pieces of paired data that is height and weight, then I put in a a height into an input box, click the button, your program should predict this person's weight.

10/8 → 10/12

Work on the Least-squares project described above for your out of class project

m= (n*(sum of xi * yi) - (sum of xi) * (sum of yi)) / (n * (sum of xi * xi) - (sum of xi)2  )

-- or --

b = ((sum of yi) - m * (sum of xi))/n

-- or --

Make a functinons for:

  • sum of xi * yi

  • sum of xi

  • sum of yi

  • sum of xi * xi

  • (sum of xi)2


10/15 → 10/19

Chapter 7 - Arrays

- More organized way to store a lot of related data
- Some consider this the most complex topic of the course.
- Not that hard, just another way to store a lot of related data.


Extra ->Class example of the American to British Translations



Text file for the 2-d array example: NumOfStudents.txt


The Image Editor Project:

Image Editor Assignment Page

ZIP files where you can get sample PPM files

Array example in class. ->


- Load states and their abbreviations into an array of records

- display

- find something

-Save the states.txt file to the bin folder in the debug folder in the project folder.

Project->bin->debug->put text file here.



Let's compute the average of a list of numbers.  Make sure you load the numbers into an array first.  Then loop again and determine the average.  We are using an array as practice.
List of Numbers



We can work on sorting
Write a simple program that sorts a file, we can use the egg file from way back, Use either bubble or selection sort.


Example implementation of an array of Records. 


10/22 → 10/26

Chapter 8 - Text Files

Let's edit the Justice program, add some new features.

This week I also want to make sure we've practiced the Try-Catch block.

Let's do an old exam I dug up, I want you to give it an honest try first.

Sample Exam 2

If there's time let's assume they are not sorted, and we need to sort them first.


10/29 → 11/2

Let's do a practice exam:

Load this file into an arrray of strutures: Famous.txt
- Read the data in, put the name in one list box, the date in another list box
- Make a button that puts just the people born in the 70's in the 2nd list box
- Button that displays their name and ages together in the 2nd list box; sorted by birth date

Exam 2 - 11/2


11/5 → 11/9

Chapter 9 Additional Controls and Objects

Multiform Projects

Do an example in class of a project with a database connection

11/12 - 11/16

Chapter 10 - Database

Do some more examples of database queries.






Chapter 12 - Web Applications - Making a web page with Visual Basic


11/21 & 11/23

Thanksgiving Break

11/26 →11/30


Continue with Chapter 12 - Web Applications


You will notice a WWW folder in your directory on the cs domain. Put any of your web applications there. Don't make any subdirectories other than the ones VB creates on its own.

The URL for the your web pages will be:

12/3 → 12/7

Continue working on the web application

Review for the Exam

Web Stuff:

Your web.config file uses the targetFramework="4.0" attribute, which isnít supported under IIS 6. In order to upgrade to IIS 7, the server must be upgraded from Windows 2003 to 2008.
remove the attribute from the web.config file for the directory you specified below, and it should work.

Final Exam: December 12th 10:15 → 12:15 (Final Exam)



Assignment #

Due Date



8/31 #42 Page 51


9/21 #6 Page 156


10/3 #4 Page 252
4 10/12 Least Squares - Sample of a solution


10/19 #10 Page 347  Get file here -> Employee.txt
Alternate assignment -> (See above in week 3/20 for image editor assignment)


11/9 #2 Page 451 Get a starter text file here -> Books.txt



#1 Page 487 Microland.accdb

Hints for the first part of this assignment:

  • 3 table adapters, one for each table in the database
  • Out of stock: 2 queries
    • 1st - Simple just select all itemID & Quantity from orders table
    • 2nd - Simple just select itemID, Quantity & Description from Inventory table
  • Make variables for ID, Desc, and Quantity
  • Loop through each item in 2nd query
    • Set variables from above (in for each loop)
    • dim 3rd query (in the loop) → from item in query1 where item.itemID = ID (variable) select item.quantity
    • if query3.sum > quant (variable from above) then print to list box, end loop



8 12/7


Web Page Project → #1 end of chapter 12 page 572

The text file you need → USStates.txt