Unit I — Course Intro; Visual Studio Intro

CS 1130 Visual Basic—Spring 2015

My class notes indicate my plans for the class. They sometimes communicate information that is useful to know for class and, thus, can be a reference for you. Sometimes they merely indicate talking points or planned activity. They will often have links that could be useful. All in all, they are probably worth reading/reviewing before and/or after class. Certainly, students who will be or have been absent should look here.

Day 1 — Course Intro

Logistics

Roll & Seating Chart

Instructor & Course Introduction

Programming & PcPI

This course hopes to teach (that you learn) programming (in Visual Basic). So, ...

Programming is problem solving

Like giving directions in a foreign language, programming is a problem solving activity. But, for people learning to program, there are three problems, not one. In our example, you'd first have to figure out just what directions you wanted to give. Then, you would have to translate those directions into the foreign language (and translations are not simple word for word substitutions). But if you don't know the foreign language, you have to learn the language before/as you do the translation. Similarly for programming—3 problems:

PcPI (didn't get to this in class)

Programming is often taught like math. We show you a "thing" and ask you to work on a bunch of "things" like it. Then we show you another "thing" and ask you to practice things like it. And another, and another, and ... But, they (math folks) and we (computer science folks) don't usually address what the "things" are good for—how they help us solve problems. We (several of my colleagues and it) think you will learn better if you see the how/why—the context of the problems.

PcPI (problem-centric programming instruction) attempts to focus on problems as we teach programming (rather than just teaching the language being used). So, many of the exercises and problems will be presented with a story/context or as a word problem. That means that you will have to figure out what to to before you start doing it, i.e., it will be (hopefully) a problem solving process.

In most problem solving contexts all you have to do is solve the problem. In programming you have to develop a solution to the problem and then covert the solution to a computer program. For you, there is the additional burden of learning how to program while you are doing the problem solving.

Just like riding a bike, playing a musical instrument, performing a beautiful dive, etc., programming is easy, if you know how to do it. If you don't know how to do it, it might come to you fairly easily, but it might also be quite daunting. With PcPI we are trying our best to work on all three problems: solving the problem, converting the solution to code, and learning the code and how it works.

So, ...

Wonderings? Comments?

Course Success

Our goal is to be successful? What does that mean? What can we do to make the course successful? (Discuss student responses to the following.)

Next Time/To Do:

Any final questions? comments? wonderings?   . . .   See you Thursday.

Day 2 — Visual Studio Demonstration (Flyby vs demo AND problem solving demo)

Logistics

Visual Studio

Even though our computers are not ready, I will want to provide an overview of using the system. We will do this more step by step in class, next time. The text below describes the overview, I will merely run the through the process at this time.

Overview

Visual Studio is an IDE (interactive development environment) for creating programs in a variety of languages, including Visual Basic. The first programming task is to create the forms/windows for the program. Then code can be written to indicate what happens with each of the form elements/controls.

Typically each VB program is a project which has a number of forms or windows, one of which is a start form called Form1. Forms have properties each having default or assigned values. We will want to change the values for some of the properties (e.g., name and text). Then we will start producing our forms. When we have them created we will need to identify which form we want to use as our start form.

We will typically just ignore Form1, the default form Visual Studio creates as we produce the form(s) needed for our program(s). (Ask me why if you want to know.) The general process for doing a VB program/project is:

The material below in the next class notes provides details of this process.

Problem Solving

Last time we talked about programming and problem solving. Remember that one part of programming is determining how to represent the problem using the data definitions available in the programming language. VB has controls that are a kind of data but there is other data underlying those controls. There are three (I forgot one last time) kinds of data in VB—numbers, characters, and Booleans. Boolean data consists of just two values, True and False. Our solution and our program needs to be in terms of those kinds of data.

Determining the problem representation and developing a solution/algorithm are a chicken and egg situation. One doesn't necessarily come first and they both are necessary. The material below suggests we think first about possible general solutions; then problem representation, then algorithm development.

Missing Card Problem

Next Time/To Do:

Any final questions? comments? wonderings?   . . .   Have a good weekend. See you Tuesday.

Day 3 — Visual Studio Demonstration/Practice

Logistics

Laptop Use in ITTC 328

Getting Started

The practice activity will be essentially the preparation of the forms we'll use in Unit II. The process overview is:

Before we go any further we need to sketch out our forms for the project. We need three forms—a start form, a numerics form, and a strings form. The ACSII art below approximates a sketch done on the board.

The general process for this activity is shown below. After that a more detailed set of directions is provided.

Let's Do It!

First, we'll do a step by step or the first/start form.

First Form

Questions? Comments? Wonderings?

Next Form

Okay, let's move on the the "Basic Numeric Tasks ..." form. The new things here are:

I think/hope the above material allows you to complete the second form. If not, let me know.

Third/Last Form

Okay, let's move on the the "String Tasks ..." form. Remember that you can copy and paste a label & text box pair from the previous form to this one. The "new" things here are:

It was suggested in class that we could copy and paste the buttons from the second file as a group ... and that works! And the names and text properties are copied as well and that is okay because there can controls can have the same name IF they are on different forms.

I think/hope the above material allows you to complete the last form. If not, let me know.

Next Time/To Do:

Any final questions? comments? wonderings?   . . .   Have a good weekend. See you Thursday.

Day 4 — Visual Studio Demonstration/Practice

Logistics

Last time we were working on a project that we might use when we start Unit II. I mentioned running the program but did not do anything with that. So we'll do that right quick. So ... start up Visual Studio with your program from last time loaded.

To Run the Program

When you run a Visual Basic program, it will load its start form. Typically that is the first form created in the project. But we have been ignoring that original form (Form1.vb) and creating a different start form. To make things happen correctly we need to change the start form, i.e.,

Once you've done that click on Start icon and see what happens. Hopefully the form you choose shows up. And nothing else should happen since we haven't provided and instructions to be carried out in the form. You'll need to click the red square on the toolbar to get the program to stop.

To make/allow the buttons to work, you'll need to put code like the following in each button click handler that is supposed to open a new form. (Double click on the button and insert the code below, being sure to substitute for "form name" appropriately.)

	Dim newWindow As New form name
	newWindow.ShowDialog()

To make the exit buttons work you'll need to insert the following code in their click handlers.

	Me.Close()

Zip and send the project

To share/submit your project, you will want to have the computer compress the folder into one file. The process for doing that is:

  1. be sure you get to the project folder (the one that contains everything else)
  2. right-click on the folder
  3. select Send to
  4. select Compressed (zipped) folder

    You may have a chance specify where you want the file to appear and what you the file to be named. Just be sure you can find it.

  5. change the name of the file

    Gmail will not allow you to attach .zip files, so you have to fool it by changing the name. I suggest changing .zip to .zipped or .zipp. To do so:

    • right click on the file name and select Rename
    • add ped or p to the name

    You should now be able to attach the file to your Gmail mail message. But you might have difficult here. You many not be able to see the .zip extension in which case changing the name does not affect the extension. You will need to fix it by:

    1. opening up the Control Panel in Windows (click on the Start icon and select Control Panel)
    2. selecting Appearance and Personalization
    3. selecting Folder Options
    4. clicking on the View tab
    5. clicking on Hide extensions for known file types so it is not checked

    Problems/questions/wonderings?

Next Time

  • We will finish Unit I (I hope)
  • Closing comments/questions?

Day 3 — VB Forms & Controls; Comp.Demo I expectations

Logistics

  • Roll
  • Today: Finish Demo;  Recap for Comp.Demo I
  • Comments/Questions?

Our Sample Project (continued)

Last time we had gotten started on our first/sample project. The project demonstrates how to:  use Visual Studio,  create a new project,  specify a Windows form application and name the form,  and adjust some of the form properties. We got most of the controls on the form but will still need to do the picture box and related resources and the menu strip that allows the file menu to show up.

And this is a good time to demonstrate compressing files and uncompressing. Any questions before we start?

First, an announcement. Our tech folks seem not to have figured out just how we can save Windows files to flash drives. So, we'll have to muddle through by you zipping it and sending yourself a copy of the file via e-mail or count on me uploading my file to the notes directory on the server and you downloading and unzipping before/as class starts. That'll be our first task today.

  • download, unzip, and load my program into Visual studio on your machine
    • go to the notes directory (http://www.cs.uni.edu/~east/teaching/vb/current/notes/)
    • click on the zipped project from last time (jpe_sample0114.zip — watch/determine where it gets stored (I suggest the desktop)
    • unzip it

      right-click on the file, then select Extract all (there may be other choices on non-lab machines).

    • find the .sln file and double-click it to start Visual Studio

      open folders starting with the one with the same name as the zipped file until you find the file

  • Questions/difficulties/comments/wonderings?
  • Pick up where we left off last time

Next Time

  • You should have completed the Unit I learning activity We'll address questions/difficulties in class.
  • We'll start on Unit II—I provide information that should prepare you for Unit II practice.
  • We'll have the Unit I competency demo in class on Tuesday.
  • Closing comments/questions?

Day 4 — Unit I Review; Comp.Demo I Expectations

Logistics

  • Roll
  • Today: Recap for Comp.Demo I; Start Unit II
  • Comments/Questions?

I believe we have seen just about everything we need to see. At the end of last class period a couple students notified me of difficulty in changing the name of their zipped file from something.zip to something.zipped. If you cannot see the .zip you cannot change it. Windows typically doesn't show the extension on a file unless it is uncommon. So, you don't see the .xlsx of Excel files or the .docx of Word files or the .pdf of PDF files or the .zip of compressed files. If you can't see the .zip on your file you need to change a setting on your computer. To do that:

  • Go to the Start menu and select Control Panel. The goal is to change the Folder Options
  • Different systems may show different things
    • if your system shows Folder Options, click on it.
    • if it doesn't, look for Appearance and Personalization (the main topic, not one of the subtopics) and click on it. You should see Folder Options, click on it.
  • Click on the View tab
  • Find Hide extensions for known file types and make sure it is not checked
  • Click the Apply button
  • Click the Okay button (you should be done)

Unit I Recap

As a result of this unit you should be prepared to create Visual Basic projects with:

  • multiple forms (in the same project)
  • a variety of form elements/controls (text boxes, labels, group boxes, radio buttons, check boxes, buttons, picture boxes, and possibly some others
  • changing form and element/control properties, in particular:

    Name (using standard prefixes),  TextBackColorForeColorFont (font, style, size),  ControlBoxReadOnlySize (manually or via property values),  AutoSizeTextAlign,  and probably some others

    Note that some of these properties apply to all or nearly all controls while others may apply only to a few

And you should be able to compress/zip projects, change their names, send the compressed folder as an e-mail attachment, and decompress/unzip them. The competency demo will require that you do this.

Next Time

  • Work on Unit II
  • Competency Demo I.a
-->