As David suggested, keep your values ββon the list. This is easier than disabling individual variables, and can be extended to as many values ββas required (up to millions of values).
If for some reason you need to save separate variables, do this:
Dim max As Integer = a Dim name As String = "A" If b > max Then max = b name = "B" End If If c > max Then max = c name = "C" End If If d > max Then max = d name = "D" End If ' ... extend to as many variables as you need. MsgBox(name & " is greater")
source share