Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i have two text fields, in the first fields when i type 1(digits) and it must convert to one(string) in the second field and so on. how to do.
thanks in advance.
Posted

Use a list or array of the words "one", "two", etc and use the number to index into the list. Basic programming really.
 
Share this answer
 
With 2 textboxes on your form named TextBox1 and Textbox2;

VB.NET
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    Dim stringArray() As String = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}

    Dim inputNumber As Integer = 0
    Dim outputString As String = String.Empty

    If IsNumeric(TextBox1.Text) Then
        For Each item As String In TextBox1.Text.ToCharArray
            inputNumber = CInt(item)

            outputString = outputString + stringArray(inputNumber)
        Next
    End If
    TextBox2.Text = outputString
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900