Type CustomerRecord ' 定义用户自定义的数据类型。 ID As Integer ' 将此定义放在常规模块中。 Name As String * 10 Address As String * 30 End TypeDim Customer As CustomerRecord ' 声明变量。 Dim MyInt As Integer, MyCur As Currency Dim MyString, MyLen MyString = "Hello World" ' 设置变量初值。 MyLen = Len(MyInt) ' 返回 2。 MyLen = Len(Customer) ' 返回 42。 MyLen = Len(MyString) ' 返回 11。 MyLen = Len(MyCur) ' 返回 8。
Option ExplicitPrivate Sub Command1_Click() MsgBox "TEXT的文字长度是:" & Label1.Width
End SubPrivate Sub Form_Load() Label1.AutoSize = True Label1.Caption = "" Label1.Visible = False Label1.Font.Name = Text1.Font.Name Label1.Font.Size = Text1.Font.Size Label1.Font.Bold = Text1.Font.Bold End SubPrivate Sub Text1_Change() Label1.Caption = Text1.Text End Sub
用API:Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" ( _ ByVal lpString As String) As Long
Private Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" ( _ ByVal lpString As String) As LongPrivate Sub Command1_Click() Dim strTmp As String strTmp = "I·þÁËU" MsgBox "I·þÁËU µÄ³¤¶ÈÊÇ:" & lstrlen(strTmp) End Sub
刚才出现乱码了,重发一次:Private Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" ( _ ByVal lpString As String) As LongPrivate Sub Command1_Click() Dim strTmp As String strTmp = "I服了U" MsgBox "I服了U 的程度是:" & lstrlen(strTmp) End Sub
msgbox lenb(strconv("中国2"),vbfromunicode)
Dim N As Long N = LenB(StrConv(Text1.Text, vbFromUnicode)) MSGBOX N
ID As Integer ' 将此定义放在常规模块中。
Name As String * 10
Address As String * 30
End TypeDim Customer As CustomerRecord ' 声明变量。
Dim MyInt As Integer, MyCur As Currency
Dim MyString, MyLen
MyString = "Hello World" ' 设置变量初值。
MyLen = Len(MyInt) ' 返回 2。
MyLen = Len(Customer) ' 返回 42。
MyLen = Len(MyString) ' 返回 11。
MyLen = Len(MyCur) ' 返回 8。
Option ExplicitPrivate Sub Command1_Click()
MsgBox "TEXT的文字长度是:" & Label1.Width
End SubPrivate Sub Form_Load()
Label1.AutoSize = True
Label1.Caption = ""
Label1.Visible = False
Label1.Font.Name = Text1.Font.Name
Label1.Font.Size = Text1.Font.Size
Label1.Font.Bold = Text1.Font.Bold
End SubPrivate Sub Text1_Change()
Label1.Caption = Text1.Text
End Sub
用API:Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" ( _
ByVal lpString As String) As Long
ByVal lpString As String) As LongPrivate Sub Command1_Click()
Dim strTmp As String
strTmp = "I·þÁËU"
MsgBox "I·þÁËU µÄ³¤¶ÈÊÇ:" & lstrlen(strTmp)
End Sub
ByVal lpString As String) As LongPrivate Sub Command1_Click()
Dim strTmp As String
strTmp = "I服了U"
MsgBox "I服了U 的程度是:" & lstrlen(strTmp)
End Sub
N = LenB(StrConv(Text1.Text, vbFromUnicode))
MSGBOX N
msgbox lenb(strconv("中国2"),vbfromunicode)
回复人: tztz520(宏宏) ( ) 信誉:100 2004-04-02 08:50:00 得分:0
Dim N As Long
N = LenB(StrConv(Text1.Text, vbFromUnicode))
MSGBOX N
蹭分