Jerry_Pang
asked on
How to set locale in VB?
I want to set my application Locale to "En-US"
how?
how?
ASKER
in .net i just need to set the current thread to locale(culture)
https://www.experts-exchange.com/questions/21176707/is-there-a-setlocale-in-net.html
i found out that what i need is to set the vb program not the vb.net locale.
can i do it programatically?
this problem is related to the above link.
https://www.experts-exchange.com/questions/21176707/is-there-a-setlocale-in-net.html
i found out that what i need is to set the vb program not the vb.net locale.
can i do it programatically?
this problem is related to the above link.
One option could be ...
since you can easily call WSH functions from Vb by sourcing in wsh references.
in wsh you could easily setLocale("<locale>")
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctsetlocale.asp
Hope this helps
since you can easily call WSH functions from Vb by sourcing in wsh references.
in wsh you could easily setLocale("<locale>")
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctsetlocale.asp
Hope this helps
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
good stuff. a lot of work.
i will split the points now. I will accept that there is no setlocale for application. i believe this answers my question.
in vb.net you only need to set the culture.
my experience with coldfusion, you only need to set the locale in application.cfm
<cfset locale="en-US"> something like that.
thank you for all your inputs.
sorry but i cant change the locale of the OS in regional settings(or doing something similar)
i have found the root cause for problem already.
the problem was calling asc() or ascw() funtions.
It only returns an Interger (-32,000 to 32,000)
we use this function to return the numeric value of the characters.
the chinese unicode are from 20,000 to 40,000.
Some of the unicode charactes returns a negative value which causes the bug.
I dont use time or date or currency values.
funny thing is that, if i use english language, the bug does not occur, except for chinese or korean languages in regional settings.
thanx,
jerry
i will split the points now. I will accept that there is no setlocale for application. i believe this answers my question.
in vb.net you only need to set the culture.
my experience with coldfusion, you only need to set the locale in application.cfm
<cfset locale="en-US"> something like that.
thank you for all your inputs.
sorry but i cant change the locale of the OS in regional settings(or doing something similar)
i have found the root cause for problem already.
the problem was calling asc() or ascw() funtions.
It only returns an Interger (-32,000 to 32,000)
we use this function to return the numeric value of the characters.
the chinese unicode are from 20,000 to 40,000.
Some of the unicode charactes returns a negative value which causes the bug.
I dont use time or date or currency values.
funny thing is that, if i use english language, the bug does not occur, except for chinese or korean languages in regional settings.
thanx,
jerry
Vb Integers are signed. What you need to work with Unicode is unsigned integer. Just add 65536 to negative numbers and you will be OK. Here is an example:
Public Function IsUtf16(ByVal s As String) As Boolean
Dim i As Long
Dim lLen As Long
Dim lAscW As Long
lLen = Len(s)
For i = 1 To lLen
lAscW = AscW(Mid$(s, i))
If lAscW < 0 Then
lAscW = lAscW + 65536
End If
If (lAscW > 255) Then
IsUtf16 = True
Exit Function
End If
Next
End Function
Also see http://www.vbip.com/winsock-api/template/template-02.asp
Public Function IsUtf16(ByVal s As String) As Boolean
Dim i As Long
Dim lLen As Long
Dim lAscW As Long
lLen = Len(s)
For i = 1 To lLen
lAscW = AscW(Mid$(s, i))
If lAscW < 0 Then
lAscW = lAscW + 65536
End If
If (lAscW > 255) Then
IsUtf16 = True
Exit Function
End If
Next
End Function
Also see http://www.vbip.com/winsock-api/template/template-02.asp
HKEY_CURRENT_USER\Control Panel\International\sLangu
then set the sLanguage to ENU
?