Page 1 of 1

combining strings

Posted: Sat Oct 13, 2007 7:03 pm
by grimdoomer
how can i take to strings and put them toget there like below. I want to take ex string1 and put it after string2 like string1 = hello string2 = world together = hello world.

Code: Select all

Dim strSquad As String
        Dim intTime As Integer
        Dim intRemaining As Integer
        Dim strAnswer As String

        strSquad = Val(txtSquadname.Text)
        intTime = Val(txtTime.Text)
        intRemaining = Val(txtRemaining.Text)
        strAnswer = strSquad & strSquad
        Me.txtScript.Text = strAnswer
but if i use + or & it trys to add them.

Posted: Sat Oct 13, 2007 8:01 pm
by Tural
I don't know why you're using Val(), I never have, nor have I ever seen anyone. You can just use "strSquad = txtSquadname.Text"

Code: Select all

Dim str1 As String
Dim str2 As String
Dim strResult As String

str1 = txtString1.Text
str2 = txtString2.Text

strResult = str1 & str2
txtResult.Text = strResult

Posted: Sat Oct 13, 2007 10:40 pm
by Patrickssj6
Try to make 2 quads variables with the same value.

Code: Select all

Dim strSquad(0 to 1) as String
Dim strAnswer As String 
strSquad(0) = txtSquadname.Text
strSquad(1) = txtSquadname.Text

strAnswer = strSquad(0) & strSquad(1)
Me.txtScript.Text = strAnswer
Val makes it a number. :wink:

Posted: Sun Oct 14, 2007 5:27 am
by grimdoomer
wow ya i took val() out and it seems to work. val() is what they taught me in class but i guess its only for numbers i helped my friend with that but dident think anything of it. Thanks

Posted: Sun Oct 14, 2007 8:06 am
by LuxuriousMeat
Yea, Val() gets the number value out of a string.