Solved

how to find list & decimal separator values

Posted on 1998-05-24
7
577 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

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…
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…
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…
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…
Suggested Courses
Course of the Month5 days, 23 hours left to enroll

626 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