Little more complex but if something like this would work could make adding drinks debugging etc a bit easier in the long run
Main Form
Public Class MainForm
Private DrinkName As String
Private Sub Drink1_Click(sender As System.Object, e As System.EventArgs) Handles Drink1.Click
DrinkName = "Drink 1"
LoadStartStop(DrinkName)
End Sub
Private Sub Drink2_Click(sender As System.Object, e As System.EventArgs) Handles Drink2.Click
DrinkName = "Drink 2"
LoadStartStop(DrinkName)
End Sub
Private Sub Drink3_Click(sender As System.Object, e As System.EventArgs) Handles Drink3.Click
DrinkName = "Drink 3"
LoadStartStop(DrinkName)
End Sub
Private Sub LoadStartStop(ByVal DrinkName As String)
Dim oForm As New StartStop
oForm.SetDrinkName = DrinkName
oForm.Label1.Text = DrinkName
oForm.ShowDialog()
End Sub
End Class
StartStop Form
Public Class StartStop
Private DrinkName As String = ""
Public WriteOnly Property SetDrinkName As String
Set(value As String)
DrinkName = value
End Set
End Property
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Select Case DrinkName
Case "Drink 1"
'bit address here
Case "Drink 2"
'bit address here
Case "Drink 3"
'bit address here
End Select
End Sub
End Class
Im not on a computer with AdvancedHMI at the moment thats why its just a VB button on the startstop form.