All pastes #466790 Raw Edit

jaredt

public text v1 · immutable
·published 2007-05-02 02:44 UTC
rendered paste body
Imports System.IO

Public Class carReservation

    
    Function NumberOfReservations()
        Dim counter As Integer = 0
        Dim day As Date
        Dim input As StreamReader = New StreamReader("reservations.txt")
        Dim line As String = input.ReadLine

        Do While input.Peek > -1
            day = Convert.ToDateTime(line)
            line = input.ReadLine

            If MonthCalendar.SelectionStart = day Then
                counter += 1

            End If
        Loop

        Return counter

        input.Close()



    End Function

    Sub CheckReservations()
        Dim counter As Integer
        Dim name As String = Val(NameTextbox.Text)
        Dim day As Date








        If counter < 4 Then
            Dim output As StreamWriter = New StreamWriter("reservations.txt", True)


            output.WriteLine(day)
            output.WriteLine(name)


            MessageBox.Show("You Have Reserved a Car")



            


        Else
            MessageBox.Show("Sorry, No Reservations Available Today")
            reserveButton.Enabled = False


        End If


        Return









    End Sub

    Private Sub reserveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles reserveButton.Click
        CheckReservations()
        NameTextbox.Clear()

        NameTextbox.Focus()

    End Sub