用Timer做什么?
for i = 1 to len(text1.text)
    text2.text = text2.text & " " & asc(mid(text1.text, i, 1) + (i - 1))
next

解决方案 »

  1.   

    Option ExplicitDim i As Integer
    Dim X As Integer
    Dim a() As String
    Dim t1 As String, t2 As String, t3 As String, t4 As StringPrivate Sub Command1_Click()
    If Text1 <> "" Then
    i = 0
    Text2 = ""
    Timer1.Enabled = True
    Else
    MsgBox "请输入内容!", 48, "提示"
    End If
    End SubPrivate Sub Command2_Click()
    If Text2 <> "" Then
    X = 0
    Text4 = ""
    Timer2.Enabled = True
    Else
    MsgBox "请输入内容!", 48, "提示"
    End If
    End SubPrivate Sub Form_Load()
    Timer1.Enabled = False
    Timer1.Interval = 10 
    Timer2.Enabled = False
    Timer2.Interval = 10 
    End SubPrivate Sub Timer1_Timer()
    t1 = Text1.Text
    t2 = Text2.Text
    t3 = Text3.Text
    t4 = Text4.Text
    Text3.Text = Asc(Mid(Text1.Text, Len(Text1.Text) - i, 1)) + Len(Text1.Text) - i - 1
    Text2.Text = Text3 + "," + Text2
    i = i + 1
    If i >= Len(Text1.Text) Then
    Timer1.Enabled = False
    End If
    End SubPrivate Sub Timer2_Timer()
    a = Split(Text2.Text, ",")
    Text3 = Chr(Val(a(X)) - X)
    Text4 = Text4 + Text3
    X = X + 1
    If X >= Len(Text1) Then
    Timer2.Enabled = False
    End If
    End Sub
      

  2.   

    Dim i As Integer
    Dim X As Integer
    Dim a() As String
     
    Private Sub Command1_Click()
    If Text1 <> "" Then
    i = 0
    Text2 = ""
    Timer1.Enabled = True
    Else
    MsgBox "请输入内容!", 48, "提示"
    End If
    End Sub
      
    Private Sub Form_Load()
    Timer1.Enabled = False
    Timer1.Interval = 10
    End SubPrivate Sub Timer1_Timer()
    Text3.Text = Asc(Mid(Text1.Text, Len(Text1.Text) - i, 1) + 1) + Len(Text1.Text) - i - 1
    Text2.Text = Text3 + "," + Text2
    i = i + 1
    If i >= Len(Text1.Text) Then
    Timer1.Enabled = False
    End If
    End Sub运行结果为:只能输入数字不能输入字母及符号,当输入9时出现49,应该是58的,恳求解决下为谢
      

  3.   

    Text1 输入字母,符号没有问题。什么叫“当输入9时出现49,应该是58的”?你的需求能不能说清楚一点儿?照你原来的叙述,应该与它在字符串中的位置有关。"9" 的 ASCII 码是 57,如果处于字符串的第二个字符,编码是 58。
      

  4.   

    好容易看懂了。你的意思实际上是,第 n 个字符,ASCII 码 + n。Option ExplicitDim i As Integer
    Dim X As Integer
    Dim a() As String
    Dim t1 As String, t2 As String, t3 As String, t4 As StringPrivate Sub Command1_Click()
    If Text1 <> "" Then
    i = 0
    Text2 = ""
    Timer1.Enabled = True
    Else
    MsgBox "请输入内容!", 48, "提示"
    End If
    End SubPrivate Sub Command2_Click()
    If Text2 <> "" Then
    X = 0
    Text4 = ""
    Timer2.Enabled = True
    Else
    MsgBox "请输入内容!", 48, "提示"
    End If
    End SubPrivate Sub Form_Load()
    Timer1.Enabled = False
    Timer1.Interval = 10 
    Timer2.Enabled = False
    Timer2.Interval = 10 
    End SubPrivate Sub Timer1_Timer()
    t1 = Text1.Text
    t2 = Text2.Text
    t3 = Text3.Text
    t4 = Text4.Text
    Text3.Text = Asc(Mid(Text1.Text, Len(Text1.Text) - i, 1)) + Len(Text1.Text) - i
    Text2.Text = Text3 + "," + Text2
    i = i + 1
    If i >= Len(Text1.Text) Then
    Timer1.Enabled = False
    End If
    End SubPrivate Sub Timer2_Timer()
    a = Split(Text2.Text, ",")
    Text3 = Chr(Val(a(X)) - X - 1)
    Text4 = Text4 + Text3
    X = X + 1
    If X >= Len(Text1) Then
    Timer2.Enabled = False
    End If
    End Sub
      

  5.   

    我试了,Text1 可以输入任何字符,包括汉字。