Preview

Basic Input and Output Methods for VB

Powerful Essays
Open Document
Open Document
1239 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Basic Input and Output Methods for VB
Lecture 11: Basic Input and Output
Methods for VB

Introduction


So far, we have relied on GUI-based Input/Output


By using VB controls


For Data Input to our programs






For Data Output from our programs:






= Data Entry
TextBox (our basic input tool, so far)
CheckBox, OptionBox, etc
= Data Displaying
Label, message box
ListBox

However, we may also use Files for I/O


These provide a means for long term storage of results.

Using Files for Input / Output


Process of using files for Data I/O is called File Handling


This requires not only methods for reading and writing data






But also methods for Opening and Closing files

VB provides a number of pre-defined methods for File Handling

Syntax for a general file-handling „block‟ is as follows:
FileOpen( Integer file_number , String file_name , open_mode )
Some Data Processing ( e.g., writing to or reading from a file )

FileClose( file_number )




Note: this is not a block in the formal sense (for variable scope)

FileOpen() opens a file, according to mode open_mode


This must be done before reading or writing




Every open file must be assigned a unique file number




Ex: file_name = “myfile.txt”
Ex: file_number = 1

FileClose( ) closes the file, after processing job is finished.

Modes of File Handling


Opening Files for Sequential Access


Reading/Writing one stored text data piece at a time




Input Mode (OpenMode.Input)




Used to output data, to the file start

Append Mode (OpenMode.Append)





Used to input data from file start

Output Mode (OpenMode.Output)




Usually, elements are separated by commas (comma-delimited)

Here, we focus on the basics: sequential access.

Used to update a file (add and save)
Add sequentially, from the file end

However, note that we also have random modes of Handling Files


Binary Mode

You May Also Find These Documents Helpful

  • Powerful Essays

    1. The program will present a series of user screens that prompts the user for specified input.…

    • 1488 Words
    • 6 Pages
    Powerful Essays
  • Good Essays

    A student writes a report using a word processor, saving the report in a file called my report. The student stores the file on his laptop hard disk drive. Later, he posts the file on a file-sharing site for a classmate to review the report. Then, he copies an updated version of the file to a flash drive to submit it to his instructor. Which of the following are some of the important features supplied by files as defined by a computer OS? (choose three answers)…

    • 957 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Nt1210 Chapter 1 Review

    • 1315 Words
    • 6 Pages

    9. A student writes a report using a word processor, saving the repot in a file called my_report. The student stores the file on his laptop hard disk drive. Later, he pasts the file on a file-sharing site for a classmate to review the report. Then, he copies an updated version of the file to a flash drive to submit it to his instructor. Which of the following are some of the important features supplied by files as defined by a computer OS?…

    • 1315 Words
    • 6 Pages
    Good Essays
  • Satisfactory Essays

    a. You input information perhaps via a keyboard or mouse to the computer and you receive output via a monitor or printer or some such device…

    • 1636 Words
    • 7 Pages
    Satisfactory Essays
  • Better Essays

    Input Controls

    • 1029 Words
    • 5 Pages

    Individual Accountability: the user is monitored and is personally accountable for their use on a companies’ computer. This deters the user form circumventing security policies (Goplakrishm, 2013). The user will be held accountable if security policies have been breached.…

    • 1029 Words
    • 5 Pages
    Better Essays
  • Good Essays

    VBD Brief

    • 686 Words
    • 3 Pages

    There are many benefits of having consistency throughout any organisation, whether it is in the workplace or in customer interactions. Meeting demands consistently requires the attention of top leadership and it is becoming an increasingly important factor in various industries (Pulido, Stone and Strevel, 2014). This brief will highlight the advantages of having consistency throughout ‘Prestige Worldwide’ and how we can adopt it.…

    • 686 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Vbp Case Study

    • 599 Words
    • 3 Pages

    On measurement program for clinical processes are "hospital IQR" which scores, "clinical process of care and "patient experience of care." The following are the processes of care: Fibrinolytic therapy received within 30 minutes of hospital arrival (AMI);…

    • 599 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Vb Sof 540

    • 11992 Words
    • 48 Pages

    An airline ticket is an excellent example of an item with a high value-to-weight ratio.…

    • 11992 Words
    • 48 Pages
    Powerful Essays
  • Good Essays

    · The user enters values for the length and width of a rectangle and clicks the Calculate button or presses the Enter key to activate that button.…

    • 305 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Most Personal Computers run under the MSDOS Operating System. MSDOS being the Microsoft Disk Operating System.…

    • 7665 Words
    • 31 Pages
    Powerful Essays
  • Satisfactory Essays

    | Displays items in one of four views (text only, text with small icons, text with large icons, or report view.…

    • 447 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Vb.Net Study Notes

    • 11890 Words
    • 48 Pages

    |Control.MouseDown Event - Occurs when the mouse pointer is over the control and a mouse button is pressed. |…

    • 11890 Words
    • 48 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Sample program to input a textfile and input any text and save it in that text file…

    • 289 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    The name game takes a string as input (your name) and searches through it for various tidbits of information. It can tell you your first name and last name and how many characters your name have.…

    • 1102 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    Programming in C#

    • 606 Words
    • 3 Pages

    Limitation comes in the form of whether you and others can read and follow your code…

    • 606 Words
    • 3 Pages
    Satisfactory Essays

Related Topics