I have an app where there are combo boxes. In these combo boxes I want units to populated automatically. I have built a code where there is select..case
condition. The case
statement is true but the code following the true case statement is not executed. I have analyzed it through breakpoints, and it also shows it True
but it is not executed and jumps to the end. Please advise.
Private Sub Load_units_combo_boxes()
Dim ComboBoxes As New ArrayList
For Each ComboBox In Me.Controls
If ComboBox.Name.Contains("Units") And TypeOf ComboBox Is ComboBox Then
ComboBoxes.Add(ComboBox)
End If
Next
For Each ComboBox In ComboBoxes
Select Case ComboBox.name.ToString
Case ComboBox.name.ToString.Contains("Pressure")
For Each unit In _units
If unit.contains("Pressure") Then
unit.replace("Pressure", "")
ComboBox.items.add(unit)
End If
Next
Case ComboBox.name.ToString.Contains("Distance")
For Each unit In _units
If unit.contains("Distance") Then
unit.replace("Distance", "")
ComboBox.items.add(unit)
End If
Next
End Select
Next
End Sub
Public _units As New ArrayList
Private Sub units_collection()
Dim units As New Units_and_conversions
Dim properties = units.GetType().GetProperties()
For Each prop In properties
_units.Add(prop.Name)
Next
End Sub
Public Class Units_and_conversions
Private universal_distance_unit As Double = 1
Private universal_pressure_unite As Double = 1
Public Property Distance_Meter() As Double
Get
Return universal_distance_unit
End Get
Set(value As Double)
value = universal_distance_unit
End Set
End Property
Public Property Distance_MilliMeter() As Double
Get
Return 0.001 * universal_distance_unit
End Get
Set(value As Double)
value = 0.001 * universal_distance_unit
End Set
End Property
End Class