Autocomplete a text box, with data that has been entered

1

I have a small inconvenience, it turns out that in a VB TextBox I have to write a 15-digit key, but within that string, the first 2 vary, the 6 that follow is the same information in all the chains, the ninth digit must be equal to the second, followed by two zeros (00) and hence the last 4 digits are variable.

Within the event KeyDown of the TextBox I identify a ENTER after writing the first 2 digits, what fails me is to COPY the 2nd digit to the ninth position.

Annex code to see if you can guide me.

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            TextBox1.AppendText("243810_00")
        End If
    End Sub

The underscore should be replaced by the second digit of the textBox that has been entered. I hope to give me to understand.

  

Update

Examples: If I write in the text box:

  • 18 must autocomplete with 1 8 243810 8 00
  • 12 must autocomplete with 1 2 243810 2 00
  • 20 must autocomplete with 2 0 243810 0 00
asked by SdeSistemas 24.10.2018 в 02:02
source

1 answer

1

With TextBox1.AppendText("243810" & TextBox1.Text.Substring(1, 1) & "00") you would solve that small inconvenience!

    
answered by 24.10.2018 / 16:38
source