Preparations : 1 Textbox and 1 Button

Code :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim strInput As Array 'make array variable
    Dim strResult1 As String 'text variable
    Dim strResult2 As String 'another text variable
    strInput = Split(TextBox1.Text, " ")
    'split the textbox if there is space.
    'you can also use chr(32) to replace " "
    strResult1 = strInput(0) 'split first text
    strResult2 = strInput(1) 'split second text
    MsgBox(strResult1 + strResult2)
    'combine first and second text with no space
    Catch ex As Exception
    End Try
    End Sub

Test the code, type space character between 2 words :

What we have done here?

Explanation :

  1. We have 2 words with a space character (“jenni” and “fer”)
  2. We split those words using “Split” command into array, the process is identified with space character, so we had 2 lines.
  3. We combine those words back together in one line, but this time with no space character in it.