CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 1999
    Posts
    104

    converting problems

    I need to convert a string into double to use it in a search expression.
    The problem is that I must use the European settings (, as decimal symbol) and VB uses always the VS settings. But if I try to convert the string to double (with cdbl() ) he uses the European settings ("41,2" is converted to 41,2 and not 41.2), which gives an error in the search string ( comma in expression).

    Can anyone help me with this?



  2. #2
    Join Date
    Jun 1999
    Posts
    16

    Re: converting problems

    Hi!

    I have solved this problem with following code:


    dim myStr$, myPos%
    myStr = "12,3" 'This is your number
    myPos = Instr(1,myStr,",")
    mid(myStr,myPos,1) = "." 'This converts "," to "."
    'Now myStr is "12.3"




    Pasi Salminen
    [email protected]


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured