Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. Imports System.Data.SqlClient
  2. Public Class Reservation
  3. Dim av As New System.Drawing.Bitmap(My.Resources.avseat)
  4. Dim chosen As New System.Drawing.Bitmap(My.Resources.choseat)
  5. Dim taken As New System.Drawing.Bitmap(My.Resources.takenseat)
  6.  
  7.  
  8. Private Sub Reservation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  9. Dim c As Control
  10. For Each c In Me.Controls
  11. If TypeOf (c) Is PictureBox Then
  12. CType(c, PictureBox).Image = My.Resources.avseat
  13. AddHandler c.Click, AddressOf s1_Click
  14. End If
  15. Next
  16.  
  17. Dim con As New SqlConnection
  18. con.ConnectionString = Login.constring
  19. Dim cmd As New SqlCommand("SELECT customername,seatnumber FROM tblbookings ", con)
  20. Dim ad As New SqlDataAdapter(cmd)
  21. Dim ds As New DataSet
  22. con.Open()
  23. ad.Fill(ds, "bookings")
  24. con.Close()
  25. Dim dt As DataTable = ds.Tables("bookings")
  26. Dim row As DataRow
  27. For Each row In dt.Rows
  28. CType(Controls("s" & row(1)), PictureBox).Image = taken
  29. Next
  30.  
  31. End Sub
  32.  
  33. Private Sub s1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s1.Click
  34. If CType(sender, PictureBox).Image Is av Then
  35. CType(sender, PictureBox).Image = chosen
  36. ElseIf CType(sender, PictureBox).Image Is chosen Then
  37. CType(sender, PictureBox).Image = av
  38. End If
  39. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement