Hi,
I'm trying to get two textboxes to behave in a certain way to minimize user input errors.
Unfortunately I'm stuck with a problem I dont't get resolved...
I have two textboxes in which the user may enter geographic coordinates. As an example here the format of the latitude coordinate: Textbox 1 = XX° Textbox 2 = XX.XXX minutes.
With my problem peace of code below I want to achieve two thinks. First of all it shall not be possible to enter latitudes > 90°00.000" in both textboxes and secondly it shall not be possible to enter more than 59.999" in the second textbox.
If I just program the second Case with > 59.999 everything is working fine. If I then add the case with 0.001 to 59.999 the code peace doesn't do it's job.
Any idea why that might happen and how to solve it?
Thanks!
Tobias
I'm trying to get two textboxes to behave in a certain way to minimize user input errors.
Unfortunately I'm stuck with a problem I dont't get resolved...
I have two textboxes in which the user may enter geographic coordinates. As an example here the format of the latitude coordinate: Textbox 1 = XX° Textbox 2 = XX.XXX minutes.
With my problem peace of code below I want to achieve two thinks. First of all it shall not be possible to enter latitudes > 90°00.000" in both textboxes and secondly it shall not be possible to enter more than 59.999" in the second textbox.
Code:
Dim MTI As Double = Double.Parse(Textbox2.Text.Replace(".", ","))
Select Case Int(MTI)
Case 0.001 To 59.999
If Textbox1.Text >= 90 Then
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Wrong Value." & vbNewLine & "Maximum allowable Latitude = 90°00.000"
style = MsgBoxStyle.Information
title = "Message"
response = MsgBox(msg, style, title)
Textbox2.Text = "00.000"
Textbox1.Focus()
End If
Case Is > 59.999
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Wrong Value." & vbNewLine & "No values > 59.999 allowed"
style = MsgBoxStyle.Information
title = "Message"
response = MsgBox(msg, style, title)
Textbox2.Text = "59.999"
Textbox2.Focus()
End Select
Any idea why that might happen and how to solve it?
Thanks!
Tobias