Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Data.SqlClient
- Public Class Reservation
- Dim av As New System.Drawing.Bitmap(My.Resources.avseat)
- Dim chosen As New System.Drawing.Bitmap(My.Resources.choseat)
- Dim taken As New System.Drawing.Bitmap(My.Resources.takenseat)
- Private Sub Reservation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Dim c As Control
- For Each c In Me.Controls
- If TypeOf (c) Is PictureBox Then
- CType(c, PictureBox).Image = My.Resources.avseat
- AddHandler c.Click, AddressOf s1_Click
- End If
- Next
- Dim con As New SqlConnection
- con.ConnectionString = Login.constring
- Dim cmd As New SqlCommand("SELECT customername,seatnumber FROM tblbookings ", con)
- Dim ad As New SqlDataAdapter(cmd)
- Dim ds As New DataSet
- con.Open()
- ad.Fill(ds, "bookings")
- con.Close()
- Dim dt As DataTable = ds.Tables("bookings")
- Dim row As DataRow
- For Each row In dt.Rows
- CType(Controls("s" & row(1)), PictureBox).Image = taken
- Next
- End Sub
- Private Sub s1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s1.Click
- If CType(sender, PictureBox).Image Is av Then
- CType(sender, PictureBox).Image = chosen
- ElseIf CType(sender, PictureBox).Image Is chosen Then
- CType(sender, PictureBox).Image = av
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement