Read and Write Text Files and Display Images

In this Lesson we use Visual Basic's built in "My.Computer.FileSystem" file processing to read in external data stored in a Text File, Update the Data, and then Write the updated Data back to the original Text File to replace the original file.

LessonRWTSlide01

 

We also show how to Load a Collection of Images to the Program's Resources storage area. From this Resources Storage, a specific image can then be selected and made to display in a Picture Box on the Screen Form.

LessonRWTSlide02

We then Load a Combo Box Drop Down List with Data from an Array to Create a "Selection Responsive Drop Down List", so that the entire "Player" selection and display of relevant Text and Image data is fully automated. This creates a much better "User Experience" or "UX".

LessonRWTSlide03

We improve User Efficiency by adding the Selection Responsive Combo Box which automatically kicks off the Process to bring in the appropriate Text File and Image.

LessonRWTSlide04
LessonRWTSlide05

The Step by Step Guide which is available below for this lesson, shows exactly what needs to be done.
This Guide has all of the Design Principles and Theory behind what is being done at each stage of application development.

Included in the Resources Download for this lesson are the full Visual Basic Code Listings, as well as Form Designs and Project Images for all five iterative Versions of the Program.

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:

- Introduction and Overview

VERSION 1 PROGRAM: READING IN A TEXT FILE
- Lesson Introduction
- Demonstration of Final Tennis Team Project
- Doing each Version of Program Separately
- Downloadable Resources available for this Lesson
- Introduction to File Input and Output Processing
- Setup Requirements for the Input Files
- Copying to bin\debug and File Path Names
- Detailed Design for the Screen Form
- VB My.Computer.FileSystem IO Processor Object
- File Read VB Code for Version 1 Program
- Testing and Finalisation of Version 1 Program

VERSION 2 PROGRAM: UPDATING AND RE-WRITING TEXT FILE
- Screen Form Modifications for Version 2
- VB Code to add in For V2 Update Button
- Adding in Try...Catch...End Try Processing
- Testing the Version 2 Update Button
- VB Code to add in for V2 Cancel Button
- Testing the Cancel Button and V2 Completion

VERSION 3 PROGRAM: LOADING IMAGES TO VB RESOURCES
- Overview of Version 3 Images Processing
- Adding Images to VB Resources - 6 Steps
- VB Code to add in for Version 3
- Testing Version 3 Player Image Display
- Adding in an Error Image for Not Found

VERSION 4 PROGRAM: LOAD COMBO BOX FROM ARRAY
- Overview of Version 4 Combo Box
- Concept of Data Driven Applications
- Quick Review of VB Combo Box
- Version 3 Form Modifications
- Using Quick Replace on VB Code
- Adding Player Names Array Code
- Loading the Combo Box from the Array
- Testing the Version 4 Program
- Program Crash for Names not on Team
- Limiting the Combo Box to the List
- Blank Combo List Program Crash
- Fixing Crash with Try...Catch...End Try

VERSION 5 PROGRAM: AUTOMATED COMBO BOX
- Overview of Automated Combo Box Changes
- Combo Box SelectedIndexChanged Event
- Program Code for "ProcessPlayer" Subroutine
- Testing the Version 3 Program Changes
- Removing the Show Button and its Subroutine
- Testing the Finished Program

TEXT FILES INPUT AND OUTPUT LESSON FINAL WRAP UP
- Program Refactoring Opportunities
- Challenge Task: Automate the Array

Watch the following YouTube Video Tutorial about Text Files and Images.
 
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.

If you would like to use our Tennis Player Images for your Project, click the links below to download them for Free:

Click here to Download Tennis Image 1 Aldin
Click here to Download Tennis Image 2 Anna
Click here to Download Tennis Image 3 Bernada
Click here to Download Tennis Image 4 John

 

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