Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lab Exercise: Reading Files and Procedures in VBA, Lab Reports of Information Technology

Instructions for two exercises in visual basic for applications (vba). The first exercise involves reading data from a text file named employees.txt and displaying the years of employment for female employees. The second exercise covers creating and calling a procedure to compute the price based on the number of units entered in a textbox.

Typology: Lab Reports

Pre 2010

Uploaded on 08/09/2009

koofers-user-2ej
koofers-user-2ej 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Lab Exercise: Reading Files and Procedures in VBA and more Lab Reports Information Technology in PDF only on Docsity! IST 256 Lab 18 – March 26, 2008 1. Understanding reading a file. Assume that there is a text file named Employees.txt that contains data where each line has an employee name (with a first and last name), a gender code (either M or F), and the number of years employed by the company. Ben Barron, M, 3 Chris Carrol, F, 5 Dale Evans, F, 8 Eric Farrell, M, 4 Read the following program fragment that will be executed as part of a button procedure. Assume that the variables empname, gender, years, number and text have been declared. FileOpen(1, "Employees.txt", OpenMode.Input) text = "Employee Years" & vbCrLf number = 0 While Not EOF(1) Input(1, empname) Input(1, gender) Input(1, years) number = number + 1 If gender = "F" Then text = text & empname & " " & years & vbCrLf End If End While Label1.Text = text a. What will the label text look like as a result of this program? Write the lines in the space below: b. During the execution of the while loop, write here the successive values of the variables for each time the loop is executed: Variable: Value before loop: Value 1 st time loop Value 2 nd time loop Value 3 rd time loop Value 4 th time loop number empname gender years
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved