Results 1 to 5 of 5

Thread: How to limit Globalization.convertToLocalTemp(Q, False)

  1. #1
    Maximum Bitrate jmullan99's Avatar
    Join Date
    Feb 2009
    Location
    Niagara Falls, Ontario
    Posts
    682

    How to limit Globalization.convertToLocalTemp(Q, False)

    I have limited width for label on my panel. I wish the temp to be returned with 1 decimal accuracy.

    When OM converts a value from one temp type to another (in this case, supplying F and returning C - my regional value), the calculation can return more than 1 decimal. I would try something like FormatNumber() but the string value from the convertToLocalTemp contains text other than the numbers.
    Code:
    B.Text = Globalization.convertToLocalTemp(Q, False)
    In my particular instance, the returned value is something like "24.833DC" (sorry, don't know how to provide the degrees symbol here, so used 'D'). I only have room for "24.8DC".

    I currently have no more space. The labels above the small buttons (D1, D2, etc) are user definable so there is really no more character space there. The blank space below the small buttons and progress bars would have additional buttons and progress bars depending on the capabilities of the attached Arduino. I could shrink the progress bars.

    I'm sure mostly due to my lack of VB.NET experience but can anyone offer up a solution?

    Cheers,
    John
    Attached Images Attached Images  
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

  2. #2
    Maximum Bitrate kegobeer's Avatar
    Join Date
    Nov 2010
    Location
    Panama City Beach
    Posts
    629
    You could use string manipulation to truncate everything. I'd do it in the convertToLocalTemp function, because you can do it before the degree and Celsius/Fahrenheit symbols are added. I don't have the function to look at, but if you can find it and post it I can probably show you what to edit.

    It's possible to do it after the convert function - it just means a few more steps (finding the ".", taking it + one more space to the right, and combining it with the last two characters).

  3. #3
    Maximum Bitrate jmullan99's Avatar
    Join Date
    Feb 2009
    Location
    Niagara Falls, Ontario
    Posts
    682
    Thanks for the offer. The function is part of the OpenMobile core and I won't be changing it.

    I agree I could do some string manipulation with it's output before I display it. I'm not one to complain about extra work. I was hoping there was a cleaner method.

    John
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

  4. #4
    Maximum Bitrate kegobeer's Avatar
    Join Date
    Nov 2010
    Location
    Panama City Beach
    Posts
    629
    Truncating is pretty clean, and pretty easy. If you want I can post the edits necessary to do it immediately after the convertToLocalTemp call.

  5. #5
    Maximum Bitrate jmullan99's Avatar
    Join Date
    Feb 2009
    Location
    Niagara Falls, Ontario
    Posts
    682
    Thanks again. I listened, and I played. I missed the fact that VAL() will only pay attention to the first numbers (if any) in a string. That little tidbit helped a lot. Now I use:
    Code:
    B.Text = Globalization.convertToLocalTemp(Q, True)
    B.Text = FormatNumber(Val(B.Text), 1) & Mid(B.Text, Len(B.Text) - 1, 2)
    This assumes of course that there will be the degrees symbol and one additional character at the end of the string.

    Working so far!!!
    Last edited by jmullan99; 02-13-2011 at 04:38 PM.
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

Similar Threads

  1. False floor standoffs
    By greywolfe in forum Fabrication
    Replies: 3
    Last Post: 06-13-2006, 11:34 AM
  2. False floor
    By i3igmind in forum Fabrication
    Replies: 29
    Last Post: 02-04-2006, 10:28 PM
  3. True or False Game.
    By lostreception in forum Off Topic
    Replies: 170
    Last Post: 11-01-2005, 05:54 AM
  4. can i claim false advertising?
    By [H]Bugster in forum General Hardware Discussion
    Replies: 13
    Last Post: 01-12-2004, 04:56 PM
  5. false monitor adapter
    By ShinkunoNamida in forum General Hardware Discussion
    Replies: 8
    Last Post: 06-04-2002, 08:28 AM

Bookmarks

Posting Permissions

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