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


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

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
Hello eesdil,

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


eesdilAuthor Commented:
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


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

Open in new window

TimCotteeHead of Software ServicesCommented:

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

        Dim instance As Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eesdilAuthor Commented:
Hi Tim,

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

best regards,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.