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

Visual Basic Help

  1. Apr 28, 2004 #1

    I no very little about visual basic yet I need to write a program that will format some text. A simple enough task that shouldn't take long to complete...

    Basically I'm given a text file with something like

    Code (Text):
    Smith John  HIS  GEO  ENG  MUS  GST 06/03/85
    Blake Nathan  MAT  HIS  MUS
    Hunter Matt  GER  PHY  12/12/86
    and I need to write a function that will format the line so it writes a new text file as shown below.

    Code (Text):

    FIRST NAME   SURNAME       DOB          AS1    AS2    AS3    AS4    AS5  
    John         Smith         06/03/85     HIS    GEO    ENG    MUS    GST
    Nathan       Blake                      MAT    HIS    MUS
    Matt         Hunter        12/12/86     GER    PHY
    I can show someone what I've done so far (it will open and read the text file) but I just don't know how to write the function since my ability to write in VB is limited and I need to have this completed by Friday. I tend to leave things till the last minute, yes I'm an idiot.

    If someone could help me out at bit it would be cool if you could email me at neutrik007@yahoo.com
  2. jcsd
  3. Jun 30, 2004 #2
    Ok use the
    Space (20 ) or

    ' The Tab function can be used with the Print # statement.
    Open "TESTFILE" For Output As #1 ' Open file for output.
    ' The second word prints at column 20.
    Print #1, "Hello"; Tab(20); "World."
    ' If the argument is omitted, cursor is moved to the next print zone.
    Print #1, "Hello"; Tab; "World"
    Close #1 ' Close file

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Visual Basic Help
  1. Visual Basic 5.0 help. (Replies: 12)

  2. Visual Basic Help (Replies: 4)

  3. Visual Basic Help (Replies: 2)

  4. Visual Basic Help (Replies: 1)