Results 1 to 2 of 2

Thread: OpenFileSorted...HELP!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353

    OpenFileSorted...HELP!

    Here is the coding I have so far:

    Dim HUDdatafile As String
    OpenFileSorted.ShowDialog()
    HUDdatafile = OpenFileSorted.FileName
    Dim sr As IO.StreamReader
    sr = IO.File.OpenText(HUDdatafile)

    When the box opens for you to pick a file and then if I hit Cancel, it gives me an error. What code should I use so it doesn't do that? Please help! Thanks!

    Brenda

  2. #2
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    VB Code:
    1. Dim HUDdatafile As String
    2. Dim sr As IO.StreamReader
    3. OpenFileSorted.ShowDialog()
    4. HUDdatafile = OpenFileSorted.FileName
    5. If HUDdatafile.Length > 0 Then
    6.     sr = IO.File.OpenText(HUDdatafile)
    7. End If
    Whadayamean it doesn't work....
    It works fine on my machine!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width