75) Design a form and write a program in visual basic for a random-access file. Input some record in the file. Record contains name and total marks and name of this random file is marks.dat. After appending record in the file, add 10 marks in any one record in that file by calling it using get statement?


Private Type Student
    SName As String * 20
    TM As String * 3
End Type

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



Comments are closed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: