Skip to content

Instantly share code, notes, and snippets.

@lxe
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save lxe/8f369f062a83d0467e63 to your computer and use it in GitHub Desktop.

Select an option

Save lxe/8f369f062a83d0467e63 to your computer and use it in GitHub Desktop.
Option Compare Database
Private Sub Form_Current()
Dim MyTools(2) As String
Dim MyButtons(2) As String
Dim state As String
Dim i As Integer
Dim colors As New Dictionary(Of String, Integer)
MyTools(1) = "Plasma-Therm Versaline"
MyTools(2) = "5 Target #1"
MyButtons(1) = "Text1"
MyButtons(2) = "Text2"
colors.Add("Up", 32768)
colors.Add("Down", 255)
colors.Add("Target Change", 8388736)
colors.Add("Maintenance", 1030655)
colors.Add("Limited", 65280)
colors.Add("Idle", 10066329)
colors.Add("Install", 16711680)
colors.Add("Development", 33023)
colors.Add("Material Assist", 12695295)
colors.Add("Process Qual", 16774400)
colors.Add("Waiting for Engineer", 65535)
For i = 1 To 2
state = DLookup("State", "Current Tool States", "Tool= '" & MyTools(i) & "' ")
If (colors.ContainsKey(state)) Then
Controls(MyButtons(i)).BackColor = colors(state)
Else
Controls(MyButtons(i)).BackColor = 0
End If
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment