30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 17 Files and Streams 827<br />

93 MessageBoxBut<strong>to</strong>ns.OK, MessageBoxIcon.Error)<br />

94 End If<br />

95<br />

96 txtAccount.Clear() ' clear text box<br />

97 End Sub ' DeleteRecord<br />

98<br />

99 End Class ' FrmDeleteDialog<br />

Fig. 17.23 FrmDeleteDialog class enables users <strong>to</strong> remove records from files in<br />

transaction-processor case study (part 3 of 3).<br />

SUMMARY<br />

All data items processed by a computer ultimately are reduced <strong>to</strong> combinations of zeros and ones.<br />

The smallest data items that computers support are called bits and can assume either the value 0<br />

or the value 1.<br />

Digits, letters and special symbols are referred <strong>to</strong> as characters. The set of all characters used <strong>to</strong><br />

write programs and represent data items on a particular computer is called that computer’s character<br />

set. Every character in a computer’s character set is represented as a pattern of 1s and 0s<br />

(characters in <strong>Visual</strong> <strong>Basic</strong> are Unicode characters, which are composed of 2 bytes).<br />

A field is a group of characters (or bytes) that conveys some meaning.<br />

A record is a group of related fields.<br />

At least one field in a record is chosen as a record key, which identifies that record as belonging<br />

<strong>to</strong> a particular person or entity and distinguishes that record from all other records in the file.<br />

Files are used for long-term retention of large amounts of data and can s<strong>to</strong>re those data even after<br />

the program that created the data terminates.<br />

A file is a group of related records.<br />

Data maintained in files is often called persistent data.<br />

Class File enables programs <strong>to</strong> obtain information about a file.<br />

Class Direc<strong>to</strong>ry enables programs <strong>to</strong> obtain information about a direc<strong>to</strong>ry.<br />

Class FileStream provides method Seek for repositioning the file-position pointer (the byte<br />

number of the next byte in the file <strong>to</strong> be read or written) <strong>to</strong> any position in the file.<br />

The most common type of file organization is a sequential file, in which records typically are<br />

s<strong>to</strong>red in order by the record-key field.<br />

When a file is opened, an object is created, and a stream is associated with the object.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!