Display a textfile created in vb using wordpad or word.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Semajthewise
    New Member
    • Nov 2007
    • 38

    Display a textfile created in vb using wordpad or word.

    Paramiters;
    vb.net 2003
    XP OS

    I looked and cannot seem to find a way to display a file that is created by a vb app heres what I have.


    First I create the file showme.txt
    This on a button click event.
    I needed to delete the file if it existed first
    [code=vbnet]
    If File.Exists(pat h1) Then
    File.Delete(pat h1)
    End If
    sw = File.CreateText (path1)
    [/code]

    Then I added lots of text
    [code=vbnet]
    sw.WriteLine("W elcome to Show Me")
    sw.WriteLine()
    sw.WriteLine("H ere we will take the numbers you have entered and show")
    sw.WriteLine("y ou how to add them to get an answer.")
    sw.WriteLine()
    sw.WriteLine("F irst lets get the sumbers you entered")
    sw.WriteLine()
    If length1 > 0 Then
    sw.WriteLine((V al(AddBox1.Text )))
    End If
    If length2 > 0 Then
    sw.WriteLine((V al(AddBox2.Text )))
    End If
    If length3 > 0 Then
    sw.WriteLine((V al(AddBox3.Text )))
    End If
    If length4 > 0 Then
    sw.WriteLine((V al(AddBox4.Text )))
    End If
    If length5 > 0 Then
    sw.WriteLine((V al(AddBox5.Text )))
    End If
    ' about 200 more lines follow with code to move the numbers arround ect...
    [/code]

    Then I flushed and closed it.
    [code=vbnet]
    sw.Flush()
    sw.Close()
    [/code]
    Now how do I open it for the user to read immediately?
    Everything writes and saves fine. I can open the file manually through explorer
    but I need it to open immediately after it is finished being written to.
    [code=vbnet]
    ' code to open the file for the user to read
    [/code]

    Any helpfull advice, links, ect would be greatly appreciated.

    Thanks in advance,
    Semajthewise
    P.S. I'd prefer wordpad
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    This post may help:
    Open wordpad/notepad file

    Comment

    • Semajthewise
      New Member
      • Nov 2007
      • 38

      #3
      Originally posted by kenobewan
      This post may help:
      Open wordpad/notepad file

      The link did not help in my problem. I kept getting "process not defined" error and tried a few imports but to no avail. But I did get an answer from a programmer I met and all that is needed is the line

      [code=vbnet]
      diagnostics.pro cess.start(file name)
      [/code]
      very simular to what was posted.
      then I discovered that I needed to import "system.diagnos tics" to do it the way posted which was not stated in the post.

      Thanks for the link and the help tho

      Comment

      Working...