Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/vb6/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb6 更改文本字符_Vb6 - Fatal编程技术网

Vb6 更改文本字符

Vb6 更改文本字符,vb6,Vb6,我想用文本框中的数字替换字母表,并在另一个测试框的结果中显示。不知道如何实现此目的。请帮助 Private Sub Form_Load() txtID.Text = "a s d f" txtSerial.Text = txtID.Text End Sub Private Sub cmdGet_Click() Dim i as Integer fsID = UCase(Replace(txtID.Text, " ", "")) ' Remove all spaces ' For i = 1

我想用文本框中的数字替换字母表,并在另一个测试框的结果中显示。不知道如何实现此目的。请帮助

Private Sub Form_Load()
txtID.Text = "a s d f"
txtSerial.Text = txtID.Text
End Sub

Private Sub cmdGet_Click()
Dim i as Integer
fsID = UCase(Replace(txtID.Text, " ", ""))   ' Remove all spaces '
For i = 1 To Len(fsID) 
ch = Mid(fsID, i, 1)        
               '    Decoder                        '
Next                                 
End Sub

Private Sub Decoder()
Select Case ch
    Case "A"
        txtSerial.Text = Replace(txtID.Text, "A", "0")
    Case "B"
        txtSerial.Text = Replace(txtID.Text, "B", "1")
    Case "H"
        txtSerial.Text = Replace(txtID.Text, "H", "2")
    Case "E"
        txtSerial.Text = Replace(txtID.Text, "E", "3")
    Case "M"
        txtSerial.Text = Replace(txtID.Text, "M", "4")
    Case "N"
        txtSerial.Text = Replace(txtID.Text, "N", "5")
    Case "T"
        txtSerial.Text = Replace(txtID.Text, "T", "6")
    Case "I"
        txtSerial.Text = Replace(txtID.Text, "I", "7")
    Case "P"
        txtSerial.Text = Replace(txtID.Text, "P", "8")
    Case "R"
        txtSerial.Text = Replace(txtID.Text, "R", "9")
    End Select

   End Sub

我不明白你想要什么。这能奏效吗



Private Sub Form_Load()
    txtID.Text = "a s d f"
    txtSerial.Text = txtID.Text
End Sub

Private Sub cmdGet_Click()
    txtSerial.Text = UCase(txtID.Text)
    txtSerial.Text = Replace(txtSerial.Text, "A", "0")
    txtSerial.Text = Replace(txtSerial.Text, "B", "1")
    txtSerial.Text = Replace(txtSerial.Text, "H", "2")
    txtSerial.Text = Replace(txtSerial.Text, "E", "3")
    txtSerial.Text = Replace(txtSerial.Text, "M", "4")
    txtSerial.Text = Replace(txtSerial.Text, "N", "5")
    txtSerial.Text = Replace(txtSerial.Text, "T", "6")
    txtSerial.Text = Replace(txtSerial.Text, "I", "7")
    txtSerial.Text = Replace(txtSerial.Text, "P", "8")
    txtSerial.Text = Replace(txtSerial.Text, "R", "9")
    txtSerial.Text = Replace(txtSerial.Text, " ", "")
End Sub

工作完美。它就像一个代码生成器。根据输入的字母,我会得到相应的数字。示例abe将给出013。非常感谢。