i want to hide the other button when i click the btnSnacks/btndrinks
buttons: btndrinks, btnSnacks
table: tbldrinks, tblSnacks [I use MS access]
heres the code that i tried:
~[i use the same code in btnSnacks, i just replace the database with tblSnacks]
Private Sub btndrinks_Click(sender As System.Object, e As System.EventArgs) Handles btndrinks.Click
btndrinks1()
End Sub
Sub btndrinks1()
Dim CMD As OleDb.OleDbCommand = New OleDb.OleDbCommand("Select * from tbldrinks", con)
Dim rd As OleDbDataReader = CMD.ExecuteReader()
If rd.HasRows() Then
Dim pos As New Point(5, 5)
Dim sz As New Size(100, 100)
Do While rd.Read()
Dim btn As New Button
btn.Name = "" & rd.Item("nod").ToString()
btn.Text = btn.Name
btn.Size = sz
btn.Location = pos
ListBox1.Controls.Add(btn)
AddHandler btn.Click, AddressOf clickMe
Dim xpos As Integer
Dim i As Integer
Math.DivRem(i, 2, xpos)
If (xpos = 0) Then
pos.X = btn.Left + btn.Width + 5
Else
pos.X = 5
pos.Y = btn.Top + btn.Height + 5
End If
Loop
End If
rd.Close()
CMD.Dispose()
End Sub