Solved

how to find list & decimal separator values

Posted on 1998-05-24
7
573 Views
Last Modified: 2010-05-18
How does one find the list separator character and decimal symbol character in windows (3.1, 95 and NT). I guess there is an api function for this but I can't find it.
0
Comment
Question by:paulmaxwell
  • 3
  • 3
7 Comments
 
LVL 7

Expert Comment

by:kamall
ID: 1458561
Use the InStr function.
I will post some code example in few minutes.
0
 
LVL 7

Expert Comment

by:kamall
ID: 1458562
On your form put one text box, one label, and one command button.
Copy and paste the following code in the command button's click event:

Private Sub Command1_Click()

CharPos1 = InStr(1, Text1, ".", 1)
CharPos2 = InStr(1, Text1, ",", 1)

If CharPos1 > 0 And CharPos2 = 0 Then
    Label1 = "A '.' character found at position " & CharPos1
ElseIf CharPos1 = 0 And CharPos2 > 0 Then
    Label1 = "A ',' character found at position " & CharPos2
ElseIf CharPos1 > 0 And CharPos2 > 0 Then
    Label1 = "A '.' character found at position " & CharPos1 & ", and a ',' found a position " & CharPos2
Else
    Label1 = "Neither a '.' nor a ',' found"
End If

End Sub

Run the project, and enter something in the text box with a '.' or a ',' or both.

Regards
0
 

Author Comment

by:paulmaxwell
ID: 1458563
Perhaps I have not been sufficiently exact in my question. I have a utility that reads MS Project MPX files for conversion into another format. MPX files are a special form of a "comma separated value" file, and the list separator is a vital ingerdient in determining the various fields of data from each line of the file. In Germany the "list separator" is a semi-colon not a comma (and the decimal symbol is a comma not a period). I need to know what windows has set as the list separator and/or decimal symbol via the control panel - regional settings. There must be a windows api function to do this?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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 7

Expert Comment

by:kamall
ID: 1458564
Yes, this can be done through API.
I don't know how, though.
0
 
LVL 1

Accepted Solution

by:
fujicast earned 50 total points
ID: 1458565
Paul,

try to use GetNumberFormat on WIN32API. For reference, try MSDN CD.
0
 

Author Comment

by:paulmaxwell
ID: 1458566
I have found the answer. GetProfileString.

    Declare Function GetProfileString Lib "Kernel" (ByVal lpAppName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer) As Integer

    Dim lpAppName As String
    Dim lpKeyName As String
    Dim lpDefault As String
    Dim lpReturnedString As String
    Dim nSize As Long
    Dim rtnLength As Long
   
    nSize = 250
   
    lpReturnedString = Space(nSize)
   
    lpAppName = "Intl"
    lpKeyName = "sList"
    rtnLength = GetProfileString(lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize)
    lpReturnedString = Left$(lpReturnedString, rtnLength)
    ' now have the list separator !
    ' more processing ...
   
    lpKeyName = "sDecimal"
    lpKeyName = "sList"
    rtnLength = GetProfileString(lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize)
    lpReturnedString = Left$(lpReturnedString, rtnLength)
    ' now have the decimal symbol
    ' more processing ...


0
 

Author Comment

by:paulmaxwell
ID: 1458567
Thanks for trying - I will look into GetNumberFormat also.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 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