TKGhoul TKGhoul - 1 month ago 11
Vb.net Question

Override String in TextBox

I have 3 text boxes on my form: Surname, First Name and Middle Name. I want to override my string. It looks like this:


...<<<<<<<<<<<<<<<<... (Length = 36)


If I save a value and the text boxes contain
Surname:Bergs, First Name:John Paul, Middle Name:Dale
, and for sample purpose I want to display this in
MessageBox
, and should be like this


D<aleBergs<<John<Paul<<<<<<<<



I have 2 objectives in this Question.


  • How can I get the Text box specific value and display it on my string?

  • If Text Box Contains space how can I turn it into
    <
    value?



Update

I solved Second Problem fix using this
String.Replace()


Dim str As String = "John Paul"
Dim str2 As String = str.Replace(" ", "<")
MessageBox.Show(str2)

Answer

If i'm right, You can get textbox inputs to separate string variables and concatenate them into one string variable or you can get all textbox values to one string variables like

Dim AllStrings As String

AllStrings = MiddleTextBox.Text &" "& FirstTextBox.Text &" "& LastTextBox.Text

Then you can replace spaces by using Replace Method.

AllStings = AllStrings.Replace(" ","<")

Hope this will helpful to you.