Solved

how to find list & decimal separator values

Posted on 1998-05-24
7
574 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Paint/Redraw window while dragging 16 88
MS Access - Capture pressed key onclick 4 43
MsgBox 2 61
MS Date Picker 64 bit 32 bit issue 12 66
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…
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…

730 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