VBI 76.PNG

Private Type Record
    EName As String * 20
    Balance As String * 5
End Type

Private Sub Command1_Click()
    Dim Employee As Record, CName, Check As String
    Dim Amount, CT, CN, RecNo As Integer
    Open "Customer.dat" For Random As #1 Len = Len(Employee)
    Check = "Y"
    RecNo = 0
    Do While Check = "Y" Or Check = "y"
        Employee.EName = InputBox("Enter Employee Name", "String")
        Employee.Balance = InputBox("Enter Blance", "Integer")
        RecNo = RecNo + 1
        Put #1, RecNo, Employee
        Check = InputBox("Do You Want To Continue (Y/N) ? ", "String")
    Loop
    CName = InputBox("Enter New Name", "String")
    Amount = InputBox("Enter Amount", "Integer")
    CT = InputBox("Enter Customer Type (1/2) ?", "Integer")
    CN = InputBox("Enter Customer Number", "Integer")
    Get #1, CN, Employee
    If CT = 1 Then
        Employee.EName = CName
        Employee.Balance = Employee.Balance + Amount
        Put #1, CN, Employee
    ElseIf CT = 2 Then
        Employee.EName = CName
        Employee.Balance = Employee.Balance - Amount
        Put #1, CN, Employee
    Else
        Put #1, CN, Employee
    End If
    Close #1
End Sub

VBO 76

Advertisements