Some Code Samples
Downloads: seqio.vbp seqio.frm graphs1.vbp graphs1.frm junk.txt
1. Sequential I/O of Comma Delimited Files
Private Sub Command1_Click()
Dim indate As String
Dim trans, cpu, io, disk, misc As Integer
Dim reccount, i As Integer
CD.ShowOpen 'Common Dialog Control preps. to open an input file
Open CD.filename For Input As #1
Do
Input #1, indate, trans, cpu, io, disk, misc
indate = Format(indate, "mm-dd-yy")
Print indate, trans, cpu, io, disk, misc
reccount = reccount + 1
Loop Until EOF(1)
Close #1
End Sub
2. Graphing Examples
Private Sub Command1_Click()
picBox.Cls
picBox.Scale (-2, 18)-(10, -3)
picBox.Line (-2, 0)-(10, 0) 'x axis
picBox.Line (0, 18)-(0, -3) 'y axis
picBox.Line (1, 15)-(8, 6)
End Sub
Private Sub Command2_Click()
Dim x As Single
picBox.Cls
picBox.Scale (-150, 150)-(150, -150) 'upper left to lower right
'draw axes
picBox.Line (-150, 0)-(150, 0) 'x
picBox.Line (0, 150)-(0, -150) 'y
'plot the curve - but set the first point
x = -13
picBox.PSet (x, fofx(x))
For x = x To 10
picBox.Line -(x, fofx(x))
'picBox.Circle (x, fofx(x)), Abs(x)
Next x
End Sub
Function fofx(x As Single) As Single
fofx = (x ^ 2 + 3 * x + 12)
End Function
Private Sub Command3_Click()
picBox.Cls
picBox.Scale (-4, 4)-(4, -4)
picBox.Line (-4, 0)-(4, 0) 'x
picBox.Line (0, -4)-(0, 4) 'y
picBox.Line (-0.1, 3)-(0.1, 3) 'tick line at y=3
picBox.CurrentX = 0.1 'right end of tick
picBox.CurrentY = 3
picBox.Print "y=3" 'prints the label of y=3
' correct using textheight method
'picBox.CurrentY = 3 - picBox.TextHeight("y=3") / 2
'picBox.CurrentX = 0.1
'picBox.Print "y=3"
End Sub