VB help

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





Posts: 325
Joined: Mon Mar 22, 2004 3:59 pm
Location: Everywhere but nowhere
Contact:

VB help

Post by Onetoomanysodas »

I'm trying to make a program that automatically creates xml files for you with the given name entries. I don't care if you say that will never happen i just need to know how to create multiple lines when creating files.

I used vbcrlf so it knows to go to the next line but every time i test it it tells me the error is on the first line of the script but the problem is the multiple lines. How do i make it create multiple lines correctly?

Code: Select all

Private Sub create_Click()

Dim intMsg As String
Dim StudentName As String

Open "d:\0000\XML\assault rifle.coll.xml" For Output As #1
Text = txtfile.Text
Print #1, "<?xml version="""; 1#; """?>" + txtfile
vbCrLf "<!--Halo Map Tools: Metadata Structure File-->"
vbCrLf "blah blah blah"

Close #1

intMsg = MsgBox("assault rifle.coll.xml closed")
End Sub

EDIT: I think i might have just gotten it? before the vbcrlf i added

Code: Select all

output# 1 + ...
User avatar
Phenomena





Posts: 1510
Joined: Thu Jul 01, 2004 3:25 pm
Location: Training my ducks
Contact:

Post by Phenomena »

add a & _ to the end of the lines

Code: Select all

Private Sub create_Click()

Dim intMsg As String
Dim StudentName As String

Open "d:\0000\XML\assault rifle.coll.xml" For Output As #1
Text = txtfile.Text
Print #1, "<?xml version="""; 1#; """?>" + txtfile & _
vbCrLf "<!--Halo Map Tools: Metadata Structure File-->" & _
vbCrLf "blah blah blah"

Close #1

intMsg = MsgBox("assault rifle.coll.xml closed")
End Sub 
although it may not have spaces
Image
And if they don't accept Jesus as their Personal Savior, you can kill them later. How cool is that!
Onetoomanysodas





Posts: 325
Joined: Mon Mar 22, 2004 3:59 pm
Location: Everywhere but nowhere
Contact:

Post by Onetoomanysodas »

oh, i've just been adding Print #1 to the beginning but thanks :P
User avatar
Phenomena





Posts: 1510
Joined: Thu Jul 01, 2004 3:25 pm
Location: Training my ducks
Contact:

Post by Phenomena »

or you could put it all one one line :P

Code: Select all

Private Sub create_Click()

Dim intMsg As String
Dim StudentName As String

Open "d:\0000\XML\assault rifle.coll.xml" For Output As #1
Text = txtfile.Text
Print #1, "<?xml version="""; 1#; """?>" + txtfile  + vbCrLf + "<!--Halo Map Tools: Metadata Structure File-->" + vbCrLf  + "blah blah blah"

Close #1

intMsg = MsgBox("assault rifle.coll.xml closed")
End Sub
Image
And if they don't accept Jesus as their Personal Savior, you can kill them later. How cool is that!
Onetoomanysodas





Posts: 325
Joined: Mon Mar 22, 2004 3:59 pm
Location: Everywhere but nowhere
Contact:

Post by Onetoomanysodas »

but it's uber long, that version i displayed is censored :shock:

hehehe... :lol:
Post Reply