Solved

how to find list & decimal separator values

Posted on 1998-05-24
7
576 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

729 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