Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Need help with text in Visual Basic 2008
New Posts  All Forums:Forum Nav:

Need help with text in Visual Basic 2008

post #1 of 5
Thread Starter 
Hi, I've just made a simple auto typer and it has buttons which you can press that insert text in the text box. But at the moment it will only let one piece of text be inserted into the box, i want it so i can press two button and both of there text will appear, sorry for my bad explanation, thanks



Here is the code from one of the buttons:


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = ("red:")

End Sub
Lulz
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom 8750 X3 Sapphire RS740G2 ATI motherboard ATI HD 5770 Corsair XMS2 4GB 
Hard DriveOSPower
2x 160gb Ubununto 10.10 G7 650w 
  hide details  
Reply
Lulz
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom 8750 X3 Sapphire RS740G2 ATI motherboard ATI HD 5770 Corsair XMS2 4GB 
Hard DriveOSPower
2x 160gb Ubununto 10.10 G7 650w 
  hide details  
Reply
post #2 of 5
Quote:
Originally Posted by DreadedJoe View Post
Hi, I've just made a simple auto typer and it has buttons which you can press that insert text in the text box. But at the moment it will only let one piece of text be inserted into the box, i want it so i can press two button and both of there text will appear, sorry for my bad explanation, thanks



Here is the code from one of the buttons:


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = ("red:")

End Sub
You want to concatenate the strings. I forget what the VB syntax is but it would be something along the lines of TextBox1.Text = TextBox1.Text + ("red:")

EDIT: Try String.Concat(TextBox1.Text, str)

Where str is the text you want to add to the box.
Edited by xtascox - 1/10/11 at 11:47am
post #3 of 5
For VB .NET you can use + or & to perform string concatenation.
post #4 of 5
Thread Starter 
ahhh thanks guys
Lulz
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom 8750 X3 Sapphire RS740G2 ATI motherboard ATI HD 5770 Corsair XMS2 4GB 
Hard DriveOSPower
2x 160gb Ubununto 10.10 G7 650w 
  hide details  
Reply
Lulz
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom 8750 X3 Sapphire RS740G2 ATI motherboard ATI HD 5770 Corsair XMS2 4GB 
Hard DriveOSPower
2x 160gb Ubununto 10.10 G7 650w 
  hide details  
Reply
post #5 of 5
Quote:
Originally Posted by mott555 View Post
For VB .NET you can use + or & to perform string concatenation.
In .NET strings are immutable which means that any changes to a string (by & or +) causes the runtime to create a new string and discard the old one. These old strings are then handled during garbage collection.

This can and should be avoided by simply using the format, join or concat methods of the string object or altenatively use the StringBuilder class to create dynamic (mutable) strings.

The latter is my preferred way as it spans multiple statements and can grow as needed from it's initial 16-byte buffer that is allocated by the default constructor.
    
CPUMotherboardGraphicsRAM
I7 920 Gigabyte EX58 XFX Radeon 4870 X2 6GB Corsair 
Hard DriveOptical DriveOSMonitor
500GB Maxtor LG DVDRW Vista Ultimate x64 2 x Edge IO 22" 
KeyboardPowerMouseMouse Pad
Razer Arctosa XFX 800w BTC Cheetah Gaming Mouse None 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
I7 920 Gigabyte EX58 XFX Radeon 4870 X2 6GB Corsair 
Hard DriveOptical DriveOSMonitor
500GB Maxtor LG DVDRW Vista Ultimate x64 2 x Edge IO 22" 
KeyboardPowerMouseMouse Pad
Razer Arctosa XFX 800w BTC Cheetah Gaming Mouse None 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Need help with text in Visual Basic 2008