我编的vb加密程序出现缺少子程序,函数或属性是怎么回事?调试的时候出现问题的是程序的第一句话。
Functioncode(ByVals$,ByValkey%)DimcAsString*1,iasc%code=""Fori=1ToLen(s)c=Mid$(s,i,1)...
Function code(ByVal s$, ByVal key%)
Dim c As String * 1, iasc%
code = ""
For i = 1 To Len(s)
c = Mid$(s, i, 1)
Select Case c
Case "A" To "Z"
iasc = Asc(c) + key
If iasc > Asc("Z") Then iasc -26
code = code + Chr(iasc)
Case "a" To "z"
iasc = Asc(c) + key
If iasc > Asc("z") Then iasc -26
code = code + Chr(iasc)
Case Else
code = code + c
End Select
Next i
End Function
Private Sub encrypt_Click()
Text2.Text = code(Text1.Text, 2)
End Sub 展开
Dim c As String * 1, iasc%
code = ""
For i = 1 To Len(s)
c = Mid$(s, i, 1)
Select Case c
Case "A" To "Z"
iasc = Asc(c) + key
If iasc > Asc("Z") Then iasc -26
code = code + Chr(iasc)
Case "a" To "z"
iasc = Asc(c) + key
If iasc > Asc("z") Then iasc -26
code = code + Chr(iasc)
Case Else
code = code + c
End Select
Next i
End Function
Private Sub encrypt_Click()
Text2.Text = code(Text1.Text, 2)
End Sub 展开
1个回答
展开全部
'稍作修改:
Function code(ByVal s$, ByVal key%)
Dim c As String * 1, iasc%, i
code = ""
For i = 1 To Len(s)
c = Mid$(s, i, 1)
Select Case c
Case "A" To "Z"
iasc = Asc(c) + key
If iasc > Asc("Z") Then iasc = iasc - 26
code = code + Chr(iasc)
Case "a" To "z"
iasc = Asc(c) + key
If iasc > Asc("z") Then iasc = iasc - 26
code = code + Chr(iasc)
Case Else
code = code + c
End Select
Next i
End Function
Private Sub encrypt_Click()
Text2.Text = code(Text1.Text, 2)
End Sub
Function code(ByVal s$, ByVal key%)
Dim c As String * 1, iasc%, i
code = ""
For i = 1 To Len(s)
c = Mid$(s, i, 1)
Select Case c
Case "A" To "Z"
iasc = Asc(c) + key
If iasc > Asc("Z") Then iasc = iasc - 26
code = code + Chr(iasc)
Case "a" To "z"
iasc = Asc(c) + key
If iasc > Asc("z") Then iasc = iasc - 26
code = code + Chr(iasc)
Case Else
code = code + c
End Select
Next i
End Function
Private Sub encrypt_Click()
Text2.Text = code(Text1.Text, 2)
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询