Hello all,
I am using a combo box to show a selection of zone hours. On open it is populated like this
Dim s As String
Dim i, last As Integer = 0
Dim t as String
Dim Result As Integer = App.eHours.GetAll
If Result > 0 Then
Do Until App.eHours.RsHours.EOF
App.eHours.FillVars
If t <> App.eHours.ZoneName Then
t = App.eHours.ZoneName
s = s + Cstr(App.eHours.Zone) + " - " + t + ","
End If
App.eHours.RsHours.MoveNext
Loop
Else
s = "-1 - Business Hours,"
For i = 0 to 20
If i = 0 then
s = s + Cstr(i) + " - Standard Hours,"
Elseif i = 1 then
s = s + Cstr(i) + " - 24 Hours,"
Else
s = s + Cstr(i)
End if
Next i
End If
last = CountFields(s,",")
For i = 1 To last
Me.AddRow(NthField(s, ",", i))
Next
Me.ListIndex = 0
What it looks like is a number(zone) and a name for the zone (standard hours) with “-” in the middle 0 - Standard Hours. When the user clicks the down arrow, all available zone hours appear as described. When the user selects the one they want, I want to show only the zone number in this box. The name is populated elsewhere.
I tried in the Change event this code, but it does not work correctly.
Dim Nme As String
Dim s As String = Trim(Mid(Me.text, 1, 2))
If IsNumeric(s) = True Then
Dim Result As Integer = App.eHours.getAllZone(Val(s))
If Result > 0 Then
App.eHours.FillVars
If App.eHours.ZoneName <> "" Then Nme = App.eHours.ZoneName
Else
Result = Val(s)
If Result = -1 Then Nme = "Business Hours"
If Result = 0 Then Nme = "Standard Hours"
If Result =1 Then Nme = "24 Hours"
End If
End If
fldZoneName.Text = Nme
Me.Text = S
Any ideas what I am doing wrong? In the old RS it worked but not anymore.
Thanks,
Tim