combining strings

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
User avatar
grimdoomer




System Engineer

Posts: 1440
Joined: Mon Oct 09, 2006 4:36 pm

combining strings

Post 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.
Image
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
User avatar
Tural




Conceptionist Acolyte Bloodhound Recreator
Socialist Connoisseur Droplet Scorched Earth
Grunge

Posts: 15628
Joined: Thu Jun 16, 2005 3:44 pm
Location: Lincoln, NE
Contact:

Post 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
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post 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:
Last edited by Patrickssj6 on Sun Oct 14, 2007 9:16 am, edited 1 time in total.
...left for good
User avatar
grimdoomer




System Engineer

Posts: 1440
Joined: Mon Oct 09, 2006 4:36 pm

Post 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
Image
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
User avatar
LuxuriousMeat





Posts: 824
Joined: Thu Nov 03, 2005 6:43 pm
Location: zzzzzzzzzzzzzzzz
Contact:

Post by LuxuriousMeat »

Yea, Val() gets the number value out of a string.
Image
Post Reply