VB设计中的一个问题
我在设计时遇到这么一个问题:上面省略PrivateSubText1_Change()DimStrLengthAsIntegerDimRandomNumAsIntegerD...
我在设计时遇到这么一个问题:
上面省略
Private Sub Text1_Change()
Dim StrLength As Integer
Dim RandomNum As Integer
Dim Str1 As String
Dim a As String
Dim i, Temp
StrLength = 0
a = Text1.Text
For i = 0 To Len(a)
Temp = Asc(Mid$(a, i, 1))
If Temp > 255 Or Temp < 0 Then
StrLength = StrLength + 2
Else
StrLength = StrLength + 1
End If
Next i
StrLength = StrLength / 2
编绎时出现这么一个错误:
实时错误'5'
无效的过程调用或参数。
出错的一行为:Temp = Asc(Mid$(a, i, 1))
请问原因
我想问一下,为什么Mid函数后面要跟一个$符号呢? 展开
上面省略
Private Sub Text1_Change()
Dim StrLength As Integer
Dim RandomNum As Integer
Dim Str1 As String
Dim a As String
Dim i, Temp
StrLength = 0
a = Text1.Text
For i = 0 To Len(a)
Temp = Asc(Mid$(a, i, 1))
If Temp > 255 Or Temp < 0 Then
StrLength = StrLength + 2
Else
StrLength = StrLength + 1
End If
Next i
StrLength = StrLength / 2
编绎时出现这么一个错误:
实时错误'5'
无效的过程调用或参数。
出错的一行为:Temp = Asc(Mid$(a, i, 1))
请问原因
我想问一下,为什么Mid函数后面要跟一个$符号呢? 展开
2个回答
展开全部
Private Sub Text1_Change()
Dim StrLength As Integer
Dim RandomNum As Integer
Dim Str1 As String
Dim a As String
Dim i As Integer
Dim Temp
StrLength = 0
a = Text1.Text
For i = 1 To Len(a) '字符串起始位为1
Temp = Asc(Mid$(a, i, 1))
If Temp > 255 Or Temp < 0 Then
StrLength = StrLength + 2
Else
StrLength = StrLength + 1
End If
Next i
StrLength = StrLength / 2
End Sub
Dim StrLength As Integer
Dim RandomNum As Integer
Dim Str1 As String
Dim a As String
Dim i As Integer
Dim Temp
StrLength = 0
a = Text1.Text
For i = 1 To Len(a) '字符串起始位为1
Temp = Asc(Mid$(a, i, 1))
If Temp > 255 Or Temp < 0 Then
StrLength = StrLength + 2
Else
StrLength = StrLength + 1
End If
Next i
StrLength = StrLength / 2
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询