Visual Programming


Drag Drop Ex. 1 - File Handling Output

This exercise is to help you learn how to code.  

You should have already completed the File Handling tutorial where you learnt how to save data from a VB form into a file.  Can you remember any of the code?  The grey boxes to the left all contain one line of code.  Your task is to arrange the the lines of code in the correct order in the blue boxes.


Instructions

Read the questions in red below

Drag the code in the grey boxes on left to the blue targets on the right.

To finish, press the "Submit" button to check all your answers.

1: Which line is for a sub routine for handling a command button click event?
 
Write #1, Text1, Text2, Text3
2: Which line declares a file name variable
 
Close 'Close all open files 
3: Now tell the file name variable where the file is going to be saved to and what it's name will be
 
Dim fileName as String
4: Now open the file ready for writing data into
 
Private Sub Command1_Click()
5: Write whatever the user has entered into three textboxes into the file
 
Open fileName For Output As #1
6: Close the file
 
fileName = App.Path & "\studentRecord.txt"

Another Question

Type the correct word in the textbox below to change the code below so it adds data onto the end of a file - so doesn't overwrite any existing data.

Open fileName For Output As #1"


Another Question

Look at the line of code below

fileName = App.Path & "\logfile.txt"

If this saves my data file to the folowing folder

A:\vbcode\logfile.txt

type the app.path part into the textbox below


 

 

   

  Unit Information

Assessment

Syllabus

Scheme of Work

Notes &Tutorials

Assignments

Quizzes

Books & Things

Links

ADR 2002