VBI 74.PNG

Private Type RecordType
    SName As String * 20
    Tm As String * 3
End Type

Private Sub Command1_Click()
    Dim MyRec As RecordType, Check As String, RecNo, SearchNo As Integer
    Open "Marks.dat" For Random As #1 Len = Len(MyRec)
    RecNo = 1
    Check = "Y"
    Do While Check = "Y" Or Check = "y"
        MyRec.SName = InputBox("Enter Student Name", "String")
        MyRec.Tm = InputBox("Enter Total Marks", "Integer")
        Put #1, RecNo, MyRec
        RecNo = RecNo + 1
        Check = InputBox("Do You Want To Continue (Y/N) ?")
    Loop
    SearchNo = Val(InputBox("Which Record Do You Want To Search"))
    Get #1, SearchNo, MyRec
    Print MyRec.SName, MyRec.Tm
    Close #1
End Sub

VBO 74.PNG

Advertisements