VB Stream Reader Text Files and Arrays

This is a fun lesson where we make a VB Windows Form which gives people randomly selected "Horrible Horoscopes".

HHLessonPic01

We introduce VB File IO using Stream Reader which can read in external data stored in Text Files.

It is very important that you have done our previous Lessons on Random Number Dice Rolls and Arrays and List Boxes before attempting this Text Files Stream Reader Lesson. 

HHLessonPic02

We also Load a Combo Box and a Program Array using external Text Files.

HHLessonPic03

Finally we improve Processing Efficiency by Loading the Horoscopes Input Text File into a Program Array, instead of doing multiple reads of the text file.

HHLessonPic04

The

Step by Step Guide which is available below for this lesson, shows exactly what needs to be done.

The Download Guides have all of the Design Principles and Theory behind what is being done at each stage of application development. These resources cover all three iterative Versions of the Program.

Included in the Resources Download for this lesson are the Screen Form Designs, Program Design Pseudocode, as well as full Visual Basic Program Code Listings.

Note that the example Lesson Images shown on this web page are basic Printscreens, whereas the actual original Images are of perfect clarity and quality in the downloadable PDF Guide for this lesson.

 

LESSON OVERVIEW

This lesson consists of a Video Presentation where we cover the following:

VERSION 1 PROGRAM: HORRIBLE HOROSCOPES

- Introduction and Overview

- Demonstration of Final Completed Horoscopes Project
- Creating the Input Horoscopes Text File in Notepad
- The Internal Composition of a Text File
- How StreamReader can "see" what is in the File
- Version 1 Program Pseudocode Design
- Version 1 VB Program Code Defining Variables
- Program Code to set up VB StreamReader
- Program Code Button Click Event File Existence
- How to Copy Text File to bin\debug Folder
- Button Click Code for Opening the Input File
- Button Code for Counting the Number of Records
- Button Code for Generating a Random Record Number
- Setting up Debug Display Msgs to Check Variables
- Review of Random Numbers from Dice Roll Project
- BtnCode - StreamReading to Find the Random Record
- Button Code - Display the Horoscope onto the Form
- IPO Processing Summary for Version 1 Program

VERSION 2 PROGRAM: LOADING COMBO BOX FROM TEXT FILE

- Introduction to Version 2 Program -Combo Box
- Setting up the Text File for the Combo Box
- Setting up the Screen Form for Version 2
- Pseudocode Design for Version 2 Program
- Version 2 VB Code to Load the Combo Box
- Testing the Version 2 Program
- Adding Validation Checking to Combo Box
- Re-Testing and Completion of Version 2

VERSION 3 PROGRAM: LOADING PROGRAM ARRAY FROM TEXT FILE

- Version 3 Program with Array Processing
- Overview of Version 3 Processing
- Version 3 Pseudocode Program Design
- Version 3 Setting up VB Array and Variables
- Version 3 Form Load Submodule for Combo Box
- Version 3 - Form Load Horoscopes Array Submodule
- Version 3 - Button Code for Searching Array
- Version 3 - Testing Completed Version 3 Program
- Learning Consolidation Project-Tennis Team

Use the Timeline Index in the YouTube Video Description to go to the sections of instructions which you need to work on.

 

Watch the following YouTube Video Tutorial about Text Files and Arrays.
 
We recommend you use the RESOURCE MATERIALS available below
to follow along step by step with the Tutorial Video.

The YouTube Video is free to watch as many times as you want, and the Lesson Build Guide including all required Images and full program code listing(s) are available at a small cost which can be paid for and downloaded using PayPal.

Before purchasing and downloading the following resources, check first with your Teacher or Instructor, as they may already have copies of these documents to give to you.

Our Programming Learning Modules are designed for complete beginners, and they have been extensively trialled with High School students learning Programming for the first time. They have a proven track record of being able to get everyone up and running with Microsoft Visual Basic - the world's most popular Beginner Programmer's language.

We highly recommend using the Step by Step Summary Guide as well as the other support materials to maximise learning outcomes.

Our students have found the Summary Guide to be far more useful than re-watching the Video, when it comes time for them to apply their newly acquired skills to Application Build tasks.

Prices for the Resource Package including the Guide, Images, Form Design, and full Program Code Listings are:

A Single Computer Licence for Personal Use is $AUD 2.50 (Approx $US 1.88).

A Site Licence for Business or Education Training for up to 30 people is $AUD 5.30 (Approx $US 3.97).

Licence Documentation will be included in your Downloads.

Click the appropriate PayPal Button below to be taken to PayPal's secured Gateway and complete your purchase. 

The Transaction will be labelled on your PayPal Statement as "PASSYTUTES", and upon payment completion you need to click the PayPal option to "RETURN TO SELLER'S WEBSITE".  (THIS IS VERY IMPORTANT AS SELECTING THE "RETURN TO SELLER'S WEBSITE" OPTION TAKES YOU THROUGH TO OUR SECURE DOWNLOADS PAGE.)
On the Downloads Page you will be able to easily and directly Download your purchased Digital Products.

If you experience any problems please email us immediately at:

EmailAddressV2PNG.fw

One known issue is that if you PayPal buy using Mircosoft Edge, it often displays prices with A's around them like: A$2.50A.
The Edge purchase will work okay, but it is probably best to do Pay Pal purchases using Google Chrome as your browser.

    Get Single Computer Licence Downloads

        Get 30 Computer Licence Downloads