欢迎来到入门教程网!

vb

当前位置:主页 > 软件编程 > vb >

VBS教程:函数-SetLocale 函数

来源:本站原创|时间:2020-01-10|栏目:vb|点击:

SetLocale 函数

Sets the global locale and returns the previous locale.

SetLocale(lcid)

lcid 参数可以是任意一个合法的 32 位数值或短字符串,该值必须唯一标识一个地理区域。能被识别的值可以查阅 区域设置 ID 表。

说明

lcid 为零,区域被设置为与当前系统设置匹配。

一个 locale 是用户参考信息集合,与用户的语言、国家和文化传统有关。该 locale 决定键盘布局、字母排序顺序和日期、时间、数字与货币格式。

下面举例说明 SetLocale 函数的用法。要使用该代码,请复制标准HTML 文件中 <BODY> 标志之间的所有内容。

Enter Date in UK format: <input type="text" id="UKDate" size="20"><p>Here's the US equivalent: <input type="text" id="USdate" size="20"><p><input type="button" value="Convert" id="button1"><p>Enter a price in German:   <input type="text" id="GermanNumber" size="20"><p>Here's the UK equivalent: <input type="text" id="USNumber" size="20"><p><input type="button" value="Convert" id="button2"><p><script language="vbscript">Dim currentLocale' Get the current localecurrentLocale = GetLocaleSub Button1_onclick  Dim original  original = SetLocale("en-gb")  mydate = CDate(UKDate.value)  ' IE always sets the locale to US English so use the  ' currentLocale variable to set the locale to US English  original = SetLocale(currentLocale)  USDate.value = FormatDateTime(mydate,vbShortDate)End SubSub button2_onclick  Dim original  original = SetLocale("de")  myvalue = CCur(GermanNumber.value)  original = SetLocale("en-gb")  USNumber.value = FormatCurrency(myvalue)End Sub</script> 

请参阅

上一篇:VBS教程:运算符-连接运算符 (&amp;)

栏    目:vb

下一篇:VBS教程:函数-Second 函数

本文标题:VBS教程:函数-SetLocale 函数

本文地址:https://www.xiuzhanwang.com/a1/vb/8123.html

网页制作CMS教程网络编程软件编程脚本语言数据库服务器

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

Copyright © 2002-2020 脚本教程网 版权所有