Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7703301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:25:37+00:00 2026-05-31T23:25:37+00:00

I am a long time C# developer and have had to look at some

  • 0

I am a long time C# developer and have had to look at some VB6 code lately. After some digging, we found out that, somewhere, somehow, we are storing a number as a string. Now we are reading it back and our code is not handling culture differences very well. Here is an example:

Dim text as String
Dim myVal as Double
Set text = "1,123456"
'This sets the value of myVal to 1123456 on our system - incorrect
myVal = text

Set text = "1.123456"
'This sets the value of myVal to 1.123456 on our system - correct
myVal = text

Keeping in mind that this is VB6 and NOT VB.NET, are there any built-in methods, functions, whatever, that can convert a string to a double using a particular culture?
Or at the very least, hinting to the conversion that we may be dealing with a different format?

We are still digging how the value gets written and see if we can reverse engineer the process to give us a consistent result. However, our customer(s) already has(have) data in one format or the other (or both, we are checking…), so a proper conversion algorithm or implementation would be a better answer at this point.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:25:39+00:00Added an answer on May 31, 2026 at 11:25 pm

    I’ve used this quick and dirty function in the past to get a double from a text. Here in Argentina, people sometimes use the point and sometimes the comma to separate decimal values, so this function is ready to accept both formats. If only one punctuation is present, it’s assumed that it’s the decimal separator.

    function ConvertDBL( texto )
        dim retval, SepDecimal, SepMiles
        If texto = "" then texto = "0"
        retval = replace(trim(texto), " ", "")
        If cdbl("3,24") = 324 then
            SepDecimal = "."
            SepMiles = ","
        else
            SepDecimal = ","
            SepMiles = "."
        end if  
        If InStr( Retval, SepDecimal ) > 0 then
            If InStr( Retval, SepMiles ) > 0 then
                If InStr( Retval, SepDecimal ) > InStr( Retval, SepMiles ) then
                    Retval = replace( Retval, SepMiles, "" )
                else
                    Retval = replace( Retval, SepDecimal, "" )
                    Retval = replace( Retval, SepMiles, SepDecimal )
                end if
            end if      
        else
            Retval = replace( Retval, SepMiles, SepDecimal )
        end if
        ConvertDbl = cdbl( retval ) 
    end function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As a long time World of Warcraft player, and a passionate developer I have
I've been a developer for a long time, however forms have always been my
For a long time i have tried to work out the best way to
I'm a long time developer but not very experienced with DNS. Here's my problem:
As a long time Microsoft developer, I find MSDN to be an invaluable resource.
I'm a long-time Windows developer, having cut my teeth on win32 and early COM.
I'm a long time Windows developer, and it looks like I'm going to be
I'm a long time C++/Java developer trying to get into Python and am looking
Long time ago, the Game Developer magazine published an article about ID Software and
I've been experimenting with Adobe Flex recently. Being a long-time server-side web app developer,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.