72) Design a form and write a program in visual basic to input roll no and total marks of 10 students from keyboard. Write roll no and total marks of those students to pass.dat file which total marks is greater than or equal to 300. Write roll no and total marks of remaining student to fail.dat file?

VBI 72.PNG

Private Sub Command1_Click()
    Dim i, rn, tm As Integer
    Open "Pass.dat" For Output As #1
    Open "Fail.dat" For Output As #2
    For i = 1 To 10
        rn = InputBox("Enter Roll No ", "Integer")
        tm = InputBox("Enter Total Marks ", "Integer")
        If tm >= 300 Then
            Write #1, rn, tm
        Else
            Write #2, rn, tm
        End If
    Next i
    Close #1, #2
End Sub

VBO 72

Advertisements

Comments are closed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: