关于VB 编程的一个问题
DimwordsAsString,outAsString,wordAsString,wordslongAsInteger,nAsLong,cAsLong,asciiAsI...
Dim words As String, out As String, word As String, wordslong As Integer, n As Long, c As Long, ascii As Integer, alpha(1 To 6, 1 To 6) As String, bravo(1 To 6) As String, x As Integer, y As Integer
Private Sub Form_Load()
ascii = 48
For x = 1 To 6
For y = 1 To 6
alpha(x, y) = Chr(ascii)
If ascii = 57 Then
ascii = 97
Else
ascii = ascii + 1
End If
Next y
Next x
bravo(1) = a
bravo(2) = v
bravo(3) = f
bravo(4) = z
bravo(5) = k
bravo(6) = t
End Sub
Private Sub Command1_Click()
words = Text1.Text
wordslong = Len(words)
c = 0: n = 1
Do While c < wordslong
word = Mid(words, n, 1)
For x = 1 To 6
For y = 1 To 6
If alpha(x, y) = word Then
out = out & bravo(x) & bravo(y)
End If
Next y
Next x
c = c + 1: n = n + 1
Loop
Label1.Caption = out
End Sub
这个程序的目的是:首先构建一个表格
|a|v|f|z|k|t|
a |0|1|2|3|4|5|
v |6|7|8|9|a|b|
f |c|d|e|f|g|h|
z |i|j|k|l|m|n|
k |o|p|q|r|s|t|
t |u|v|w|x|y|z|
然后把输入的字母或数字转换为两个替代的字母输出。
(Tool 有一个Textbox,一个Label,和一个Commandbutton)
为什么运行的时候输入字母再点击Commandbutton,没有字符输出呢?
谢谢! 展开
Private Sub Form_Load()
ascii = 48
For x = 1 To 6
For y = 1 To 6
alpha(x, y) = Chr(ascii)
If ascii = 57 Then
ascii = 97
Else
ascii = ascii + 1
End If
Next y
Next x
bravo(1) = a
bravo(2) = v
bravo(3) = f
bravo(4) = z
bravo(5) = k
bravo(6) = t
End Sub
Private Sub Command1_Click()
words = Text1.Text
wordslong = Len(words)
c = 0: n = 1
Do While c < wordslong
word = Mid(words, n, 1)
For x = 1 To 6
For y = 1 To 6
If alpha(x, y) = word Then
out = out & bravo(x) & bravo(y)
End If
Next y
Next x
c = c + 1: n = n + 1
Loop
Label1.Caption = out
End Sub
这个程序的目的是:首先构建一个表格
|a|v|f|z|k|t|
a |0|1|2|3|4|5|
v |6|7|8|9|a|b|
f |c|d|e|f|g|h|
z |i|j|k|l|m|n|
k |o|p|q|r|s|t|
t |u|v|w|x|y|z|
然后把输入的字母或数字转换为两个替代的字母输出。
(Tool 有一个Textbox,一个Label,和一个Commandbutton)
为什么运行的时候输入字母再点击Commandbutton,没有字符输出呢?
谢谢! 展开
展开全部
Dim words As String, out As String, word As String, wordslong As Integer, n As Long, c As Long, ascii As Integer, alpha(1 To 6, 1 To 6) As String, bravo(1 To 6) As String, x As Integer, y As Integer
Private Sub Form_Load()
ascii = 48
For x = 1 To 6
For y = 1 To 6
alpha(x, y) = Chr(ascii)
If ascii = 57 Then
ascii = 97
Else
ascii = ascii + 1
End If
Next y
Next x
bravo(1) = "a"
bravo(2) = "v"
bravo(3) = "f"
bravo(4) = "z"
bravo(5) = "k"
bravo(6) = "t"
End Sub
Private Sub Command1_Click()
words = Text1.Text
wordslong = Len(words)
c = 0: n = 1
Do While c < wordslong
word = Mid(words, n, 1)
For x = 1 To 6
For y = 1 To 6
If alpha(x, y) = word Then
out = out & bravo(x) & bravo(y)
End If
Next y
Next x
c = c + 1: n = n + 1
Loop
Label1.Caption = out
End Sub
这样就好了,你没有加双引号
Private Sub Form_Load()
ascii = 48
For x = 1 To 6
For y = 1 To 6
alpha(x, y) = Chr(ascii)
If ascii = 57 Then
ascii = 97
Else
ascii = ascii + 1
End If
Next y
Next x
bravo(1) = "a"
bravo(2) = "v"
bravo(3) = "f"
bravo(4) = "z"
bravo(5) = "k"
bravo(6) = "t"
End Sub
Private Sub Command1_Click()
words = Text1.Text
wordslong = Len(words)
c = 0: n = 1
Do While c < wordslong
word = Mid(words, n, 1)
For x = 1 To 6
For y = 1 To 6
If alpha(x, y) = word Then
out = out & bravo(x) & bravo(y)
End If
Next y
Next x
c = c + 1: n = n + 1
Loop
Label1.Caption = out
End Sub
这样就好了,你没有加双引号
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询