PDA

View Full Version : Need some quick VisualBasic help


Brad_Ad23
Jul15-04, 12:49 AM
I have a visual basic program that outputs strings of numbers to a text file. However currently the output is in the form:

1 2 3 4 5

Note also the space infront of the first number as well. I need for the output to look like:

1,2,3,4,5

However, right now I can only get it to look like:

,1,2,3,4,5

So, is there a way to get rid of that first comma infront of the first number?

Current code for the output: If (cor > min And cor < max) Then
op = op + 1
For x = 1 To r Step 1
outString = outString + " " + CStr(a(x))
Next
Print #1, outString
outString = ""
End If

Ivan Seeking
Jul15-04, 01:05 AM
Maybe I'm missing something but can't you do something like this?

If x = 1 then
outstring = CStr(a(x))
Else
outstring = outstring + "," + " " + CStr(a(x))
Endif
?

Brad_Ad23
Jul15-04, 02:14 PM
Maybe I'm missing something but can't you do something like this?

If x = 1 then
outstring = CStr(a(x))
Else
outstring = outstring + "," + " " + CStr(a(x))
Endif
?

D'oh! Yep that does it! Thanks! :biggrin:

Ivan Seeking
Jul15-04, 03:39 PM
Glad to help. :smile: