2010-07-10 4 views
0

영문자를 텍스트 상자의 숫자로 바꾸고 다른 테스트 상자에 결과를 표시하고 싶습니다.이 방법을 알지 못합니다. 도움을 청하십시오.텍스트 문자 변경

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 

답변

1

나는 당신이 원하는 것을 이해하지 못합니다. 이게 속임수입니까?



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 
+0

완벽하게 작동합니다. 코드 생성기와 비슷합니다. 입력 한 알파벳에 따라 해당 숫자가 나옵니다. 예제 abe는 013을 제공합니다. 대단히 감사합니다. –