谢谢各位的帮助,谢谢!!!
在求教各位高手:
我如想取得一个数组的每个值,该如何作,谢谢!!
如:
Dim b() As Byte
Dim resultstring As String
Open App.Path & "\ccc.txt" For Binary Access Read As #1
ReDim b(LOF(1)) As Byte
Get #1, , b()
Close #1
Private Sub Command1_Click()
Text1.Text = StringLoopGet(Text1.Text, 1, 10)
End Sub
Function StringLoopGet(ByVal pString As String, ByVal pStart As Long, ByVal pCount As Long) As String
'StringLoopGet函数
'语法:[tOutStr] = StringLoopGet(pString, pStart, pCount)
'功能:从一个字符串指定位置循环获取指定数量的字符。
'参数:string pString '原字符串
' long pStart '必要参数。开始字符位置(如果超过字符长度则与字符长度取余)
' long pCount '必要参数。获取字符数量(如果超过字符长度则循环获取)
'输出:string tOutStr '返回获取的字符。
Dim tOutStr As String
Dim tNotOut As Boolean
tNotOut = (pString = "") Or (pCount = 0)
If tNotOut Then Exit Function
Dim tBytes() As Byte
Dim tBytes_Length As Long
Dim tWordCount As Long
发现楼上一个小小的错误哦,当TEXT控件内字符的个数不是三的整倍数的时候会出错。
Dim L as Long
Dim I as Long
L=Len(text1.text)
text1.text =text1.text & " " '最后加上两个空格,保险一点
For I = 1 To L Step 3
MsgBox Mid(Text1.txt, I,3)
Next
Private Sub Command1_Click()
Dim ss() As String
ReDim ss(1 To Len(Text1))
For i = 1 To Len(Text1) Step 3
ss(i) = Mid(Trim(Text1.Text), i, 3)
MsgBox ss(i)
Next i
End Sub