Solved

International Program

Posted on 2001-08-30
12
196 Views
Last Modified: 2008-02-01
I am trying to make my application support european number format that is a comma in place of a decimal
For that MSDN sugests using CDbl instead of val .However when i use cdbl it works fine on my pc but not on a system with it's regional settings set to german

It gives an error " Type Mismatch" error no. 13 as soon as the program is started


I have windows 200 pro and I have tried changing my regional settings to german from english united states.It works fine
0
Comment
Question by:gauravdhup
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 12

Expert Comment

by:roverm
ID: 6441867
Take a look here:

http://www.thescarms.com/vbasic/dateformat.asp

It's how to detect it and use it!

D'Mzzl!
RoverM
0
 
LVL 39

Expert Comment

by:appari
ID: 6443184
can you post the code?
0
 
LVL 12

Expert Comment

by:roverm
ID: 6443758
Just click the link and download the zip file.
It's a complete project!

D'Mzzl!
RoverM
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 12

Expert Comment

by:roverm
ID: 6443760
appari: Sorry, thought your comment was about mine .... ;-)
0
 

Accepted Solution

by:
ruchir_khanduri earned 70 total points
ID: 6443980
Hi gauravdhup,

CDbl() function gives type mismatch error is several cases. For example if you try CDbl("") it will give you the type mismatch error. So please check if the passed number is null! If it is then replace it with 0 (zero).

Moreover, to get the formatted number try to use Format function of VB. I hope it will work even on the German machine.

0
 
LVL 39

Expert Comment

by:appari
ID: 6444001
0
 

Author Comment

by:gauravdhup
ID: 6444172
The code extract which is given below seems to be causing the problem
But why is it that it works fine on my machine

Perhaps you can help me by downoading the software which I have made and testing it on your

machine Once you have downloaded it send me an e-mail at hello2000g@yahoo.com and i will send

you the international update

http://members.tripod.com/gauravcreations/iumos.html


Form2.Text4.Text = CDbl(GetSetting(App.EXEName, "Monday", "Cost", 1.2))

If Text2.Text = 1 And CDbl(Text3.Text) >= CDbl(Form2.Text66.Text) And CDbl(Text3.Text) < 

CDbl(Form2.Text65.Text) Then
Text12.Text = Form2.Text63.Text
End If
Text1.Text = Text12.Text
Text7.Text = 0
Timer2.Enabled = False
Timer1.Enabled = True
End If


    totmcost = CDbl(prevresults4) + CDbl(Text50.Text)
    Text30.Text = totmcost
       
'load chart data
Open App.Path & "\01.ium" For Append As #1
Write #1, 0
Close #1

Open App.Path & "\01.ium" For Input As #1
Input #1, jan
Close #1
inmin3 = jan / 60
Text31.Text = inmin3


If Text2.Text = 1 And CDbl(Text3.Text) >= CDbl(Form2.Text66.Text) And CDbl(Text3.Text) < 

CDbl(Form2.Text65.Text) Then
Text11.Text = Form2.Text64.Text
Text12.Text = Form2.Text63.Text
Text51.Text = Text11.Text
Text52.Text = Text12.Text
End If

Text46.Text = CDbl(Text46.Text) + 1
Text49.Text = CDbl(Text49.Text) + 1
If CDbl(Text49.Text) = CDbl(Text51.Text) Then
Text50.Text = CDbl(Text52.Text) + CDbl(Text50.Text)
Text49.Text = 0
End If

  Open App.Path & "\netusage.ium" For Input As #1
    Input #1, prevresults
    Close #1
    Text8.Text = prevresults
    prevresults1 = CDbl(Text8.Text)
    totalresults = prevresults1 + CDbl(Text46.Text)
    inmin = totalresults / 60
0
 
LVL 39

Expert Comment

by:appari
ID: 6444681
i don't know the exact reason but a simillar problem we faced when we were working for one of our french client. we solved it like this:

when reading from database (in DB the value is stored with a . as decimal separator) to convert it to French locale used val(value from DB) like val("1234566.45") returns 1234566,45

when updating to DB use str("1234566,45") returns 1234566.75

actually cdbl expects an expression which returns a numeric value. so if you try cdbl(1.2) on german locale it returns 1,2 after converting the decimal seperator.
0
 

Author Comment

by:gauravdhup
ID: 6446064
Do you find any problem with the code above
0
 

Author Comment

by:gauravdhup
ID: 6446066
Do you find any problem with the code above
0
 

Author Comment

by:gauravdhup
ID: 6446071
Do you find any problem with the code above
0
 

Author Comment

by:gauravdhup
ID: 6446075
Do you find any problem with the code above
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Specify ip address in my connection string for sas 2 66
How does CurrentUser work? 10 39
Added a column screws up code 5 63
Error with a code discussed on this page 5 33
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question