[Year 12 SofDev] Random access files
BUCKNELL, Chris
cbucknell at whitefriars.vic.edu.au
Fri Jun 3 13:55:49 EST 2011
Hi Mark,
You can still use Random access files in VB.NET (i.e. VB2010,VB2008, VB2005) . VB.NET supports traditional random access files, but it doesn't really need them. You can still create files that store structures, and access them by record numbers, as you did with previous versions of Visual Basic using the FileOpen and FileGet functions, but for the most part, the functionality of random access files has been replaced by XML and/or databases.
(http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem.fileopen.aspx)
(http://msdn.microsoft.com/en-us/library/56ec4tx7.aspx)
(http://msdn.microsoft.com/en-us/library/y3c21t77.aspx)
Public Sub RandomFileAccess()
Dim FileName As String = "TESTFILE"
Dim FileNumber As Integer = 1
Dim Value As Boolean
Dim RecordNumber As Long
' Count 30 for the string, plus 4 for the integer.
'FileOpen(FileNumber, FileName, Mode, Access, Share, RecordLength)
FileOpen(1, FileName, OpenMode.Random, , , 34)
'Gets/reads a record from the file
FileSystem.FileGet(FileNumber, Value, RecordNumber)
'Puts/writes a record from the file
FileSystem.FilePut(FileNumber, Value, RecordNumber)
' Close before reopening in another mode.
FileClose(1)
End Sub
From: sofdev-bounces at edulists.com.au [mailto:sofdev-bounces at edulists.com.au] On Behalf Of Mark KELLY
Sent: Friday, 3 June 2011 1:01 PM
To: Year 12 Software Development Teachers' Mailing List
Subject: [Year 12 SofDev] Random access files
Hi all. I used to use random files in VB6, but trying to unearth them in VB2010 Express is a problem... annoyingly, they seem to have been deprecated in favour of database solutions.
Do other GUI languages out there still support random access files?
--
Mark Kelly
Manager of ICT, Reporting, IT Learning Area
McKinnon Secondary College
McKinnon Rd McKinnon 3204, Victoria, Australia
Direct line / Voicemail: +613 8520 9085, Fax +613 9578 9253
kel at mckinnonsc.vic.edu.au<mailto:kel at mckinnonsc.vic.edu.au>
VCE IT Lecture Notes: http://vceit.com
Moderator: IT Applications Edulist
Want a good time? Call 0112358. Ask for Mr Fibonacci.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20110603/fb9dadab/attachment-0001.html
More information about the sofdev
mailing list