Click here to Skip to main content
15,887,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi im using visual basic 6. yes, its old and not cool, i know.

So i have a textbox1 with this "HELLO WORLD"

I also have textbox2 blank.

command1 button

=======================================

I want the user to type whatever inside textbox2, and click on the command1, so whatever text typed in textbox2 would get inside, in the middle of text from textbox1.
ex.

=======================================

textbox1 with this "HELLO WORLD"
textbox2 with this "BEAUTIFUL"
click on command1 button
textbox1 ends up with "HELLO BEAUTIFUL WORLD"

What I have tried:

Private Sub Command1_Click()
Text1.Text = Text2.Text
End Sub

Private Sub Form_Load()
Text1.Text = "HELLO WORLD"
End Sub


my code just copies the text2 and pastes it inside text1, thats not what im looking for!
Posted
Updated 17-Nov-20 12:31pm
Comments
Mohibur Rashid 17-Nov-20 19:06pm    
in vb6 string concatenation is done using `&`

If I remember this right, then

text1.Text = Text1.Text & ' ' & Text2.Text

1 solution

Split on blanks. (Text1)

Add new word (Text2) behind first or only word (Insert[1]).

Rejoin.

Assign to Text1.
 
Share this answer
 
v3
Comments
Member 13371798 17-Nov-20 18:33pm    
sorry i have no idea how to do that, i get what you mean in my imagination, but i dont know how to partically do it
[no name] 17-Nov-20 18:36pm    
https://www.tutlane.com/tutorial/visual-basic/vb-string-split-method
https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.strings.join?view=net-5.0
https://www.freetutes.com/learn-vb6/inserting-deleting-using-arrays.html
Maciej Los 18-Nov-20 9:20am    
5ed!

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