Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need some quick VisualBasic help

  1. Jul 15, 2004 #1
    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:
     
  2. jcsd
  3. Jul 15, 2004 #2

    Ivan Seeking

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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
    ?
     
  4. Jul 15, 2004 #3
    D'oh! Yep that does it! Thanks! :biggrin:
     
  5. Jul 15, 2004 #4

    Ivan Seeking

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Glad to help. :smile:
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Need some quick VisualBasic help
Loading...