关于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,没有字符输出呢?
谢谢!
展开
 我来答
是小白啊2k
2011-07-06 · TA获得超过2566个赞
知道小有建树答主
回答量:1183
采纳率:0%
帮助的人:1164万
展开全部
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
这样就好了,你没有加双引号
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式