Guest User

Untitled

a guest
Nov 5th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. Public Sub Form13_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  2.  
  3. Dim point As Integer
  4. Dim point1 As Integer
  5. point = 20
  6. point1 = 100
  7. counter = 0
  8. Label2.Text = Form12.selected_value
  9. Dim connection As New MySqlConnection
  10. connection.ConnectionString = ("host=localhost;user=root;password=;database=pos;")
  11. connection.Open()
  12. Dim command As New MySqlCommand("select * from categories", connection)
  13. Dim reader As MySqlDataReader
  14. reader = command.ExecuteReader
  15.  
  16. While reader.Read()
  17.  
  18. Dim button As New Button
  19. value = reader.GetString("category_name")
  20.  
  21.  
  22.  
  23.  
  24.  
  25. button.Name = value
  26. button.Text = value
  27. button.Height = 50
  28. button.Width = 190
  29. button.Font = New Font("arial", 11)
  30. button.Location = New Point(point, point1)
  31. Me.Controls.Add(button)
  32. point1 = point1 + 50
  33. counter = counter + 1
  34. verifier(0) = counter
  35. arr(counter) = value
  36.  
  37. AddHandler button.Click, AddressOf button_Click
  38. button_Click()
  39.  
  40. End While
  41.  
  42. End Sub
  43. Private Sub button_Click()
  44. MsgBox(arr(counter))
  45. End Sub
Add Comment
Please, Sign In to add comment