我有text1.text
,text2.text
和Command1_Click
在第一篇文章中我有:
WUJ QAZ SFX BG3 YBN HM OTDP WL DG5PY AGEW
没有空间,
我想在单击text2.text上用以下代码替换它:
WUJ - 0
QAZ - 1
SFX - 2
BG3 - 6
YBN - 7
HM - 8
OTDP - B
WL - D
DG5PY - E
AGEW - F
单击结果text2.text: 012678BDEF
请参见VISUAL BASIC 6.0
答案 0 :(得分:2)
这是一种方式......
Private Sub Command1_Click()
Dim str As String
str = Text1.Text
str = Replace(str, "WUJ", "0")
str = Replace(str, "QAZ", "1")
str = Replace(str, "SFX", "2")
str = Replace(str, "BG3", "6")
str = Replace(str, "YBN", "7")
str = Replace(str, "HM", "8")
str = Replace(str, "OTDP", "B")
str = Replace(str, "WL", "D")
str = Replace(str, "DG5PY", "E")
str = Replace(str, "AGEW", "F")
Text2.Text = str
End Sub