購物車.vb 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. Imports System.Data.SqlClient
  2. Public Class 購物車
  3. Dim conn As New SqlConnection("Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\奕穎\Documents\資管\大三上\系分\謎鹿\謎鹿.mdf;Integrated Security=True;Connect Timeout=30")
  4. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  5. If ((Val(耳環.TextBox2.Text) > Val(耳環.Label21.Text)) Or
  6. (Val(耳環.TextBox3.Text) > Val(耳環.Label22.Text)) Or
  7. (Val(耳環.TextBox4.Text) > Val(耳環.Label23.Text)) Or
  8. (Val(耳環.TextBox5.Text) > Val(耳環.Label24.Text))) Or
  9. (Val(吊飾.TextBox2.Text) > Val(吊飾.Label20.Text)) Or
  10. (Val(吊飾.TextBox3.Text) > Val(吊飾.Label21.Text)) Or
  11. (Val(吊飾.TextBox4.Text) > Val(吊飾.Label22.Text)) Or
  12. (Val(吊飾.TextBox5.Text) > Val(吊飾.Label23.Text)) Or
  13. (Val(指甲油.TextBox3.Text) > Val(指甲油.Label20.Text)) Or
  14. (Val(指甲油.TextBox2.Text) > Val(指甲油.Label21.Text)) Or
  15. (Val(指甲油.TextBox4.Text) > Val(指甲油.Label22.Text)) Or
  16. (Val(指甲油.TextBox5.Text) > Val(指甲油.Label23.Text)) Or
  17. (Val(便籤夾.TextBox3.Text) > Val(便籤夾.Label5.Text)) Or
  18. (Val(手工餅乾.TextBox3.Text) > Val(手工餅乾.Label5.Text)) Then
  19. MsgBox("庫存數量不足,請重新確認購買數量")
  20. Else
  21. 訂單確認.Show()
  22. Me.Visible = False
  23. End If
  24. End Sub
  25. Private Sub 購物車_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  26. If (Val(Label10.Text) = 0) Then
  27. Label10.Text = Nothing
  28. End If
  29. If (Val(Label11.Text) = 0) Then
  30. Label11.Text = Nothing
  31. End If
  32. If (Val(Label12.Text) = 0) Then
  33. Label12.Text = Nothing
  34. End If
  35. If (Val(Label13.Text) = 0) Then
  36. Label13.Text = Nothing
  37. End If
  38. If (Val(Label14.Text) = 0) Then
  39. Label14.Text = Nothing
  40. End If
  41. If (Val(Label15.Text) = 0) Then
  42. Label15.Text = Nothing
  43. End If
  44. If (Val(Label16.Text) = 0) Then
  45. Label16.Text = Nothing
  46. End If
  47. If (Val(Label17.Text) = 0) Then
  48. Label17.Text = Nothing
  49. End If
  50. If (Val(Label18.Text) = 0) Then
  51. Label18.Text = Nothing
  52. End If
  53. If (Val(Label19.Text) = 0) Then
  54. Label19.Text = Nothing
  55. End If
  56. If (Val(Label20.Text) = 0) Then
  57. Label20.Text = Nothing
  58. End If
  59. If (Val(Label21.Text) = 0) Then
  60. Label21.Text = Nothing
  61. End If
  62. If (Val(Label22.Text) = 0) Then
  63. Label22.Text = Nothing
  64. End If
  65. If (Val(Label23.Text) = 0) Then
  66. Label23.Text = Nothing
  67. End If
  68. If (Val(Label24.Text) = 0) Then
  69. Label24.Text = Nothing
  70. End If
  71. If (Val(Label25.Text) = 0) Then
  72. Label25.Text = Nothing
  73. End If
  74. If (Val(Label30.Text) = 0) Then
  75. Label30.Text = Nothing
  76. End If
  77. If (Val(Label31.Text) = 0) Then
  78. Label31.Text = Nothing
  79. End If
  80. If (Val(Label32.Text) = 0) Then
  81. Label32.Text = Nothing
  82. End If
  83. If (Val(Label33.Text) = 0) Then
  84. Label33.Text = Nothing
  85. End If
  86. If (Val(Label34.Text) = 0) Then
  87. Label34.Text = Nothing
  88. End If
  89. If (Val(Label35.Text) = 0) Then
  90. Label35.Text = Nothing
  91. End If
  92. If (Val(Label36.Text) = 0) Then
  93. Label36.Text = Nothing
  94. End If
  95. If (Val(Label37.Text) = 0) Then
  96. Label37.Text = Nothing
  97. End If
  98. If (Val(Label43.Text) = 0) Then
  99. Label43.Text = Nothing
  100. End If
  101. If (Val(Label45.Text) = 0) Then
  102. Label45.Text = Nothing
  103. End If
  104. Label48.Text = Val(Label14.Text) + Val(Label15.Text) + Val(Label16.Text) + Val(Label17.Text) +
  105. Val(Label18.Text) + Val(Label19.Text) + Val(Label20.Text) + Val(Label21.Text) +
  106. Val(Label30.Text) + Val(Label31.Text) + Val(Label32.Text) + Val(Label33.Text) +
  107. Val(Label43.Text) + Val(Label45.Text) + Val(Label51.Text)
  108. End Sub
  109. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  110. 耳環.Show()
  111. Me.Visible = False
  112. End Sub
  113. End Class