0% found this document useful (0 votes)
72 views25 pages

Public Class Private Sub Byval As Byval As Handles If and Then

The document contains code snippets from an airline reservation system written in Visual Basic .NET. It includes code for the login screen, main menu, adding a new customer, updating a customer, and flight details. The code handles user authentication, displays different forms, inserts and updates data in SQL database tables, and validates user input.

Uploaded by

Nikhil Paul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views25 pages

Public Class Private Sub Byval As Byval As Handles If and Then

The document contains code snippets from an airline reservation system written in Visual Basic .NET. It includes code for the login screen, main menu, adding a new customer, updating a customer, and flight details. The code handles user authentication, displays different forms, inserts and updates data in SQL database tables, and validates user input.

Uploaded by

Nikhil Paul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Source code

CODING IN LOGIN SCREEN:-

Public Class Form1

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

If [Link] = "admin" And [Link] = "password" Then

MsgBox("UserName and Password Accepted")

[Link]()

Else

MsgBox("You have entered wrong Username or Password")

End If

End Sub

Private Sub Button3_Click(ByVal sender As [Link], ByVal e As


[Link])

[Link]()

[Link]()

End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

MsgBox("Thanks for using Airline Reservation System ")

[Link]()

End Sub
End Class

CODING IN MAIN MENU

Public Class mainmenu

Private Sub ExitToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

End Sub

Private Sub FareDetailToolStripMenuItem_Click(ByVal sender As [Link], ByVal


e As [Link]) Handles [Link]

[Link]()

End Sub

Private Sub TicketReservationToolStripMenuItem_Click(ByVal sender As [Link],


ByVal e As [Link]) Handles [Link]

[Link]()

End Sub

Private Sub AddNewToolStripMenuItem_Click(ByVal sender As [Link], ByVal e


As [Link]) Handles [Link]

[Link]()

End Sub

Private Sub DeleteToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

End Sub
Private Sub UpdateToolStripMenuItem_Click(ByVal sender As [Link], ByVal e
As [Link]) Handles [Link]

[Link]()

End Sub

Private Sub AddNewToolStripMenuItem1_Click(ByVal sender As [Link], ByVal


e As [Link]) Handles [Link]

[Link]()

End Sub

Private Sub DeleteToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e


As [Link]) Handles [Link]

[Link]()

End Sub

Private Sub UpdateToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e


As [Link]) Handles [Link]

[Link]()

End Sub

Private Sub TicketCancellationToolStripMenuItem_Click(ByVal sender As


[Link], ByVal e As [Link]) Handles
[Link]

[Link]()

End Sub

Private Sub ReservationEnquiryToolStripMenuItem_Click(ByVal sender As


[Link], ByVal e As [Link]) Handles
[Link]
[Link]()

End Sub

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link])

[Link]()

End Sub

Private Sub CustomersToolStripMenuItem_Click(ByVal sender As [Link], ByVal


e As [Link])

[Link]()

End Sub

Private Sub FlightsToolStripMenuItem_Click(ByVal sender As [Link], ByVal e


As [Link])

[Link]()

End Sub

End Class

CODING IN ADD NEW CUSTOMER:-

Imports [Link]

Imports System

Imports [Link]

Imports [Link]

Imports [Link]

Imports [Link]
Imports [Link]

Public Class customerdetails

Private Sub Button5_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

If [Link] = "" Or [Link] = "" Or [Link] = "" Or [Link]


= "" Then

MsgBox("fill the information properly")

ElseIf IsNumeric([Link]) Then

MsgBox("name should not be numeric")

ElseIf IsInputChar([Link]) Then

MsgBox("contct should not be char")

ElseIf IsNumeric([Link]) Then

MsgBox(" Father's name should not be numeric")

ElseIf IsInputChar([Link]) Then

MsgBox("Insert D_O_B")

ElseIf IsNumeric([Link]) Then

MsgBox("address should not be numeric")

[Link]()

End If

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()
Dim PassportNo As String

PassportNo = Format([Link], "yyyyMMddhhmmss")

[Link] = PassportNo

Dim cmd As New SqlCommand("insert into customer_dtls


values(@passportno,@custname,@fathername,@d_o_b,@address,@contactno)", con)

[Link] = [Link]

[Link]("@passportNo", [Link], 50).Value = PassportNo

[Link]("@custname", [Link], 50).Value = [Link]

[Link]("@fathername", [Link], 50).Value = [Link]

[Link]("@d_o_b", [Link]).Value = [Link]

[Link]("@address", [Link], 50).Value = [Link]

[Link]("@contactno", [Link], 50).Value = [Link]

[Link]()

[Link]()

[Link]()

MsgBox("welcome you are now the customer of airline")

End Sub

Private Sub Button1_Click_1(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

[Link]()
End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

[Link]()

[Link]()

[Link]()

[Link]()

End Sub

Private Sub TextBox6_TextChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

If [Link] = "" Then

MsgBox("Insert D_O_B")

End If

End Sub

Private Sub TextBox7_TextChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

If [Link] = "" Then

MsgBox("Insert Address")

End If

End Sub
Private Sub TextBox4_TextChanged(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]

If [Link] = "" Then

MsgBox("Insert Contact_No")

End If

End Sub

Private Sub TextBox2_TextChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

If [Link] = "" Then

MsgBox("Insert Father's Name")

End If

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

If [Link] = "" Then

MsgBox("Insert Your Name")

End If

End Sub

End Class

CODING IN UPDATE CUSTOMER:-

Imports [Link]

Imports System

Imports [Link]

Imports [Link]
Imports [Link]

Imports [Link]

Imports [Link]

Public Class updatecustomer

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link])

[Link]()

End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

Dim cmd As New SqlCommand("select * from customer_dtls where passportNo=" + "'"


+ [Link] + "'", con)

adp = [Link]()

While [Link]

[Link] = adp(1)

[Link] = adp(2)

[Link] = adp(3)

[Link] = adp(4)

[Link] = adp(5)

End While
[Link]()

[Link]()

End Sub

Private Sub Button3_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim cmd As New SqlCommand("Update customer_dtls set CustName=" + "'" +


[Link] + "'" + "," + "Fathername=" + "'" + [Link] + "'" + "," + "D_O_B=" +
"'" + [Link] + "'" + "," + "Address=" + "'" + [Link] + "'" + "," +
"ContactNo=" + "'" + [Link] + "'" + "where PassportNo=" + "'" + [Link]
+ "'", con)

[Link] = [Link]

[Link]()

[Link]()

[Link]()

MsgBox("updated")

End Sub

Private Sub updatecustomer_Load(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader


Dim cmd As New SqlCommand("select * from customer_dtls", con)

adp = [Link]()

While [Link]

[Link](adp(0))

End While

[Link]()

End Sub

Private Sub Button1_Click_1(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

[Link]()

End Sub

End Class

CODING IN FLIGHT DETAILS:-

Imports [Link]

Imports System

Imports [Link]

Imports [Link]

Imports [Link]

Imports [Link]

Imports [Link]

Public Class flightdetails


Private Sub Button2_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim cmd As New SqlCommand("insert into Flight_dtls


values(@flightname,@flightcode,@classname,@totalseats,@flightsource,@flightdestination,
@departure,@arrival,@fare)", con)

[Link] = [Link]

[Link]("@flightname", [Link], 50).Value = [Link]

[Link]("@flightcode", [Link], 50).Value = [Link]

[Link]("@classname", [Link], 50).Value = [Link]

[Link]("@totalseats", [Link], 50).Value = [Link]

[Link]("@flightsource", [Link], 50).Value =


[Link]

[Link]("@flightdestination", [Link], 50).Value =


[Link]

[Link]("@departure", [Link], 50).Value = [Link]

[Link]("@arrival", [Link], 50).Value = [Link]

[Link]("@fare", [Link], 50).Value = [Link]

[Link]()

[Link]()

[Link]()

MsgBox("welcome in airline....new flight has been Added")


End Sub

Private Sub Button3_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

[Link]()

[Link]()

[Link]()

[Link]()

[Link]()

End Sub

Private Sub Button1_Click_1(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

[Link]()

End Sub

End Class

CODING IN UPDATE Plane

Imports [Link]

Imports System

Imports [Link]

Imports [Link]

Imports [Link]

Imports [Link]

Imports [Link]
Public Class Updateplane

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link])

[Link]()

End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim cmd As New SqlCommand("Update flight_dtls set flightcode=" + "'" +


[Link] + "'" + "," + "classname=" + "'" + [Link] + "'" + "," + "totalseats=" +
"'" + [Link] + "'" + "," + "flightsource=" + "'" + [Link] + "'" + "," +
"flightdestination=" + "'" + [Link] + "'" + "where flightname=" + "'" +
[Link] + "'", con)

[Link] = [Link]

[Link]()

[Link]()

[Link]()

MsgBox("updated")

End Sub

Private Sub Updateplane_Load(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation
System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

Dim cmd As New SqlCommand("select * from flight_dtls", con)

adp = [Link]()

While [Link]

[Link](adp(0))

End While

[Link]()

[Link]()

End Sub

Private Sub Button3_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

Dim cmd As New SqlCommand("select * from flight_dtls where flightname=" + "'" +


[Link] + "'", con)

adp = [Link]()

While [Link]

[Link] = adp(1)
[Link] = adp(2)

[Link] = adp(3)

[Link] = adp(4)

[Link] = adp(5)

[Link] = adp(6)

[Link] = adp(7)

[Link] = adp(8)

End While

[Link]()

[Link]()

End Sub

Private Sub Button1_Click_1(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

[Link]()

End Sub

End Class

CODING IN TICKET RESERVATION

Imports [Link]

Imports System

Imports [Link]

Imports [Link]

Imports [Link]
Imports [Link]

Imports [Link]

Public Class Ticketreservation

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

If [Link] = 5 Then

[Link] = 5 * [Link]

ElseIf [Link] = 4 Then

[Link] = 4 * [Link]

ElseIf [Link] = 3 Then

[Link] = 3 * [Link]

ElseIf [Link] = 2 Then

[Link] = 2 * [Link]

ElseIf [Link] = 1 Then

[Link] = 1 * [Link]

End If

End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link])

[Link]()

End Sub

Private Sub Ticketreservation_Load(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation
System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

Dim cmd As New SqlCommand("select * from flight_dtls", con)

adp = [Link]()

While [Link]

[Link](adp(0))

End While

[Link]()

[Link]()

End Sub

Private Sub Button3_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

'' Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

'[Link]()

'Dim cmd As New SqlCommand("insert into ticket_dtls


values(@ticketNumber,@customername,@Ticketreaservation)", con)

'[Link] = [Link]

'

' Dim TicketNumber As String

' TicketNumber = Format([Link], "yyyyMMddhhmmss")

' [Link] = TicketNumber

' [Link]()

' [Link]()

' [Link]()
MsgBox("Ticket reserved")

End Sub

Private Sub Button2_Click_1(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

[Link]()

End Sub

Private Sub Button4_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

Dim cmd As New SqlCommand("select * from flight_dtls where flightname=" + "'" +


[Link] + "'", con)

adp = [Link]()

While [Link]

[Link] = adp(6)

[Link] = adp(7)

[Link] = adp(4)

[Link] = adp(5)

[Link] = adp(8)

[Link] = adp(2)

End While

[Link]()
[Link]()

End Sub

End Class

CODING IN TICKET CANCELLATION

Imports [Link]

Imports System

Imports [Link]

Imports [Link]

Imports [Link]

Imports [Link]

Imports [Link]

Public Class TicketCancellation

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link] = [Link] * 20 / 100

[Link] = [Link] - [Link]

End Sub

Private Sub Button4_Click(ByVal sender As [Link], ByVal e As


[Link])

[Link]()

End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation
System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

Dim cmd As New SqlCommand("select * from Cancel where TicketNumber=" + "'" +


[Link] + "'", con)

adp = [Link]()

While [Link]

[Link] = adp(1)

[Link] = adp(2)

[Link] = adp(3)

End While

[Link]()

[Link]()

End Sub

Private Sub TicketCancellation_Load(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

Dim cmd As New SqlCommand("select * from Cancel", con)

adp = [Link]()
While [Link]

[Link](adp(0))

End While

[Link]()

End Sub

Private Sub Button3_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim cmd As New SqlCommand("delete from cancel where TicketNumber=" & "'" &
[Link] & "'", con)

[Link] = [Link]

[Link]()

[Link]()

[Link]()

MsgBox("Ticket Cancelled")

End Sub

End Class

CODING IN TICKET ENQUIRY

Imports [Link]

Imports System

Imports [Link]

Imports [Link]

Imports [Link]

Imports [Link]
Imports [Link]

Public Class TicketEnquiry

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link])

[Link]()

End Sub

Private Sub Button2_Click_1(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

[Link]()

[Link]()

End Sub

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

Dim cmd As New SqlCommand("select * from cancel where TicketNumber=" + "'" +


[Link] + "'", con)

'Dim cmd As New SqlCommand("select * from flight_dtls where TicketNumber=" + "'"


+ [Link] + "'", con)

adp = [Link]()
While [Link]

[Link] = adp(1)

[Link] = adp(2)

[Link] = adp(3)

[Link] = adp(4)

[Link] = adp(5)

End While

[Link]()

[Link]()

End Sub

Private Sub TicketEnquiry_Load(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

Dim con As New SqlConnection("server=SAHIL-PC;database=D:\Airline Reservation


System - Copy\Airline Reservation System\data\[Link];Integrated Security=True")

[Link]()

Dim adp As SqlDataReader

'Dim cmd As New SqlCommand("select * from cancel", con)

Dim cmd As New SqlCommand("select * from flight_dtls", con)

adp = [Link]()

While [Link]

[Link](adp(0))

End While

[Link]()

[Link]()

End Sub
End Class

You might also like