+ Post New Thread
Results 1 to 2 of 2
Coding Thread, Inner Exception Unhandled in VB Express project... in Coding and Web Development; Greeting everyone! Thank you in advance for your help. Here is my problem. I am trying to code a simple ...
  1. #1

    Join Date
    Jul 2007
    Thank Post
    Thanked 0 Times in 0 Posts
    Rep Power

    Inner Exception Unhandled in VB Express project...

    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


    ' Returning only the number portion ignoring the

    ' degree F

    Return CDbl(lblTemperatureCurrent.Text.Substring(0, _


    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.

  2. #2

    vikpaw's Avatar
    Join Date
    Sep 2006
    Saudi Arabia
    Thank Post
    Thanked 1,383 Times in 1,145 Posts
    Rep Power

    Re: Inner Exception Unhandled in VB Express project...

    hi, i'm rubbish at coding, but if the error is where you think it is then i'd imagine the problem is the search for index of [degree symbol] could be something to do with keyboard character codes or something.

    you should be able to convert the symbol or lookup the ascii code for it and search for that. i'm not sure how the symbol ends up in the variable anyway.

    to debug, at the point where the function is called just do a messagebox that outputs the variable:


    that might shed more light on it.

    alternatively, you can do a count from the end of the variable, i.e. show text from 0 to variable.text.length - 2 or something like that.

    the bit i'm not sure about is if you declare the function as double in the first part of the if statement, can you return integer.minvalue? is that allowed?

    hope it helps

+ Post New Thread

Similar Threads

  1. SIMS SQL upgrade. To Express or not to Express?
    By woody in forum MIS Systems
    Replies: 5
    Last Post: 16th October 2007, 04:34 PM
  2. ICT Project Manager
    By SpecialAgent in forum Educational IT Jobs
    Replies: 0
    Last Post: 28th February 2007, 06:03 PM
  3. Gizmo Project
    By CyberNerd in forum Educational Software
    Replies: 0
    Last Post: 2nd October 2006, 09:47 PM
  4. new toys - Project MIX I/O
    By plexer in forum Hardware
    Replies: 0
    Last Post: 15th August 2006, 01:10 PM
  5. An interesting CDT project maybe?
    By Ric_ in forum Jokes/Interweb Things
    Replies: 1
    Last Post: 12th April 2006, 08:34 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts