0
" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "

I want to add this whole thing into a string variable and i want to join it to another string!!

jay
  • 33
  • 1
  • 9
  • 1
    It looks like you are building a (SQL) query string. Be careful about injection attacks. http://stackoverflow.com/questions/910465/avoiding-sql-injection-without-parameters?rq=1 – tgolisch Jan 20 '14 at 17:19
  • oh!! k Sure!!! i am a newbie!! – jay Jan 20 '14 at 17:29
  • I would also use a stringBuilder rather than join values using & – Mych Jan 20 '14 at 17:43

1 Answers1

1

I'm not 100% sure what your asking here but to establish a new string you would use this code:

Dim FirstName As String = "Bob" 
Dim LastName As String = "Roberts"

'Dim refers to a local variable only accessible within the current type. To make it accessible everywhere, replace 'Dim' with 'Public'

To join strings together, you can use either the & operator or the + operator but be careful with the + as it sometimes tries to add strings to integers ("test" + 32 will result in an error while debugging). Example:

Dim FullName As String = FirstName & " " & LastName

This line of code will give you "Bob Roberts"...

I hope this helped with your question!

Rodit

rodit
  • 1,746
  • 2
  • 19
  • 33