Visual Basic Explorer
Visual Basic Explorer
 Navigation
 Home


 Coding
 Source Code

 FAQ Center

 VB Tips

 Downloads

 ToolBox

 Tutorials

 VB Games

 VB News

 VB Award

 VB Forums



 Affiliates
 Planet Source Code

 Rent a Coder

 DirectX4VB


 Misc
 Search

 Feedback

 Advertise

 About


Need to hire
a VB coder?

Please support our sponsor:

 Home 
 Site Map 
 Forums 
 News 
 Feedback 

 

'---------------------------------------------
'How To: Read and Write to a Random File Type?
'Posted: 08-June-00
'Author: Marcel Broesky
'
'Description: Sample code for reading and writing
'to and from Random File Types.
'---------------------------------------------

 
Private Type employee

 
empID As Integer
lname As String * 30
fname As String * 20
title As String * 20

 
End Type

 
----------------------------------------------------------------------

 
Private Sub Command1_Click()

Dim emp1 As employee

Open "d:\tdv\dat\dat.dat" For Random As #1 Len = Len(emp1)

For i = 1 To 5

Get #1, i, emp1
Text1.Text = Text1.Text & "Name: " & Trim$(emp1.fname) & " " &
Trim$(emp1.lname) & vbCrLf & "Title: " & Trim$(emp1.title) & _
vbCrLf & "ID: " & Trim$(emp1.empID) & vbCrLf

Next

Close #1

 
End Sub

 
----------------------------------------------------------------------

 
Private Sub Command2_Click()

 
Dim emp1 As employee

Open "d:\tdv\dat\dat.dat" For Random As #1 Len = Len(emp1)

For i = 1 To 5

 
With emp1
.lname = InputBox$("Enter Last Name")
.fname = InputBox$("Enter First Name")
.title = InputBox$("Enter Title")
.empID = i
End With

 
Put #1, , emp1

Next i

Close #1

 
End Sub

 

 

 
'----------------------------
'Burt Abreu
'Visual Basic Explorer
'http://www.VBExplorer.com
'June 07, 2000
'----------------------------


Downloads

In IE right-click and select 'Save Target As...' or in Netscape right-click and select 'Save Link As...'

 

View Plain Text View Plain Text
Download Demo Project Not Available
View Code Online Not Available





Home | About | What's New | Source Code | FAQ | Tips & Tricks | Downloads | ToolBox | Tutorials | Game Programming | VB Award | Search | VB Forums | Feedback | VBNews | Copyright & Disclaimer | Advertise | Privacy Policy |

Quick searches: Site Search | Advanced Site Search 

Copyright 2002 by Exhedra Solutions, Inc.
By using this site you agree to its terms and conditions
VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc.