?
Solved

How can I get the List Separator under Visual Basic .NET 2003?

Posted on 2008-11-14
4
Medium Priority
?
1,822 Views
Last Modified: 2012-05-05
Dears,

I would like to ask if you could advice how can I get the List Separator from Locale in VB 2003.
If I used the solution of VB 6 (GetLocalInfo()) it was not working.

Could you tell me what i did wrong?

Thank you so much
best regards
Public Declare Function GetLocaleInfo Lib "kernel32" Alias _
      "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, _
           ByVal cchData As Long) As Long
 
Public Const LOCALE_SLIST = &HC
 
Dim ListSeparator As String
GetLocaleInfo(Locale, LOCALE_SLIST, ListSeparator, 0)

Open in new window

0
Comment
Question by:eesdil
  • 2
  • 2
4 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 22958442
Hello eesdil,

Dim ListSeparator As String = System.Globalization.TextInfo.ListSeparator()

Regards,

TimCottee
0
 

Author Comment

by:eesdil
ID: 22958532
Hi Tim,

Thank you for the quick answer.
but I have some issues with it :)
Do I have to declare something for it?

I have tried usage from msdn, but it didnt work either...
It is throwing an excepten: Object reference not set to an instance of an object

Could you help what it is?
thanks in advance

regards,
csaba

Dim infoInstance As TextInfo
Dim listSep As String
 
listSep = infoInstance.ListSeparator

Open in new window

0
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 total points
ID: 22958573
eesdil,

As always it is never quite as easy as it should be:

TimCottee
        Dim instance As Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
        MsgBox(instance.TextInfo.ListSeparator)

Open in new window

0
 

Author Comment

by:eesdil
ID: 22958589
Hi Tim,

thanks a lot it is working perfectly (out of box)

best regards,
csaba
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 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

850 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