Private Sub Text1_Change() If Len(Trim(Text1.Text)) >= 1 Then If Asc(Right(Text1.Text, 1)) = 10 Then Text2.Text = Text2.Text + "_" Else Text2.Text = Text2.Text + CStr(Asc(Right(Text1.Text, 1)) - 64) End If End If End Sub上面的例子对于单个字符就可以满足你的实时转化的要求了。不知对你有没有帮助或启发?
If Len(Trim(Text1.Text)) >= 1 Then
If Asc(Right(Text1.Text, 1)) = 10 Then
Text2.Text = Text2.Text + "_"
Else
Text2.Text = Text2.Text + CStr(Asc(Right(Text1.Text, 1)) - 64)
End If
End If
End Sub上面的例子对于单个字符就可以满足你的实时转化的要求了。不知对你有没有帮助或启发?
Bb=2
B=3
C=4
Db=5
D=6
Eb=7
E=8
F=9
Gb=10
G=11
Ab=12
strTmp = Replace(Text1, vbCrLf, "-")
strTmp = Replace(strTmp, "Bb", "2")
strTmp = Replace(strTmp, "Db", "5")
strTmp = Replace(strTmp, "Eb", "7")
strTmp = Replace(strTmp, "Gb", "10")
strTmp = Replace(strTmp, "Ab", "12")
strTmp = Replace(strTmp, "A", "1")
strTmp = Replace(strTmp, "B", "3")
strTmp = Replace(strTmp, "C", "4")
strTmp = Replace(strTmp, "D", "6")
strTmp = Replace(strTmp, "E", "8")
strTmp = Replace(strTmp, "F", "9")
strTmp = Replace(strTmp, "G", "11")
Text2 = strTmp
End Sub