Jump to content

rmetz527

Members
  • Posts

    1
  • Joined

  • Last visited

Reputation

0 Neutral

About rmetz527

Personal Information

  • Location
    Michigan
  1. Greeting everyone! Thank you in advance for your help. Here is my problem. I am trying to code a simple weather tracker program in VB Express. I have it built, but it always throws an exception in my 'ExtractTemperature' Function. Let me post that function: [align=center]Private Function ExtractTemperature() As Double If (lblTemperatureCurrent.Text.Length = 0) Then Return Integer.MinValue Else ' Returning only the number portion ignoring the ' degree F Return CDbl(lblTemperatureCurrent.Text.Substring(0, _ lblTemperatureCurrent.Text.IndexOf("º"))) End If End Function[/align] The 'lblTemperatureCurrent.Text is supposed to be in the form of an integer followed by the degree symbol followed by F. The function should strip the degree symbol and F off the integer, returning just the integer value. I am under the impression that the lblTemperatureCurrent.Text.IndexOf function is returning a -1 which is throwing the exception. How can I get the value of lblTemperatureCurrent.Text at that point so I can tell if it is a problem with the value of the variable or the fault of the function itself? Again, thank you for your help.
×
×
  • Create New...