Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. New to VB - NewFile Dialog / SaveFile Dialog help needed.

New to VB - NewFile Dialog / SaveFile Dialog help needed.

Scheduled Pinned Locked Moved Visual Basic
helpcsharphardwaretutorialquestion
18 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C ChandraRam

    You will need to use the "Basic" methods for file handling. For example:

    FileHandle = FreeFile()
    Open [FilePath] for Output as FileHandle
    Print #FileHandle,"This is a test string"
    Close FileHandle

    HTH [Edit]Had to change since < was intepreted differently[/Edit]

    A Offline
    A Offline
    Adam m Nelson
    wrote on last edited by
    #9

    That did it! thank you very much

    --Its not broken if it never worked.

    C 1 Reply Last reply
    0
    • A Adam m Nelson

      That did it! thank you very much

      --Its not broken if it never worked.

      C Offline
      C Offline
      ChandraRam
      wrote on last edited by
      #10

      Adam.m.Nelson wrote:

      That did it! thank you very much

      You are welcome. :)

      A 1 Reply Last reply
      0
      • C ChandraRam

        Adam.m.Nelson wrote:

        That did it! thank you very much

        You are welcome. :)

        A Offline
        A Offline
        Adam m Nelson
        wrote on last edited by
        #11

        Do you know if it is possible to bring up the 'Save As' window to allow the user to select the save location and file name? I got it working allowing the user to enter the location and file name in a seperate cell, but it would be handy to bring up the dialog they are use to seeing any other time they save a windows file.

        --Its not broken if it never worked.

        C 1 Reply Last reply
        0
        • A Adam m Nelson

          Do you know if it is possible to bring up the 'Save As' window to allow the user to select the save location and file name? I got it working allowing the user to enter the location and file name in a seperate cell, but it would be handy to bring up the dialog they are use to seeing any other time they save a windows file.

          --Its not broken if it never worked.

          C Offline
          C Offline
          ChandraRam
          wrote on last edited by
          #12

          This dialog is implemented in the CommonDialog Windows control. You can add reference to the ComDlg32.OCX object in your script and use the methods in this object to Open / Save files. This will bring up the familiar Windows file dialog. HTH

          A 1 Reply Last reply
          0
          • C ChandraRam

            This dialog is implemented in the CommonDialog Windows control. You can add reference to the ComDlg32.OCX object in your script and use the methods in this object to Open / Save files. This will bring up the familiar Windows file dialog. HTH

            A Offline
            A Offline
            Adam m Nelson
            wrote on last edited by
            #13

            Beautiful, I will try that tonight. If its not too much to ask, I have another quick question: This way of doing it leaves an extra cariage return at the end of the file, i tried writing a \b to the file once it is all done, but it literally writes a \b in the file. Print #FileHandle, "\b" Print #FileHandle, '\b' isn't a command as the ' starts a comment. Is there a way to kill that last cariage return?

            --Its not broken if it never worked.

            C D 2 Replies Last reply
            0
            • A Adam m Nelson

              Beautiful, I will try that tonight. If its not too much to ask, I have another quick question: This way of doing it leaves an extra cariage return at the end of the file, i tried writing a \b to the file once it is all done, but it literally writes a \b in the file. Print #FileHandle, "\b" Print #FileHandle, '\b' isn't a command as the ' starts a comment. Is there a way to kill that last cariage return?

              --Its not broken if it never worked.

              C Offline
              C Offline
              ChandraRam
              wrote on last edited by
              #14

              The Print statements appends a CR+LF to the text... I don't know of a way you could suppress this.

              A 1 Reply Last reply
              0
              • C ChandraRam

                The Print statements appends a CR+LF to the text... I don't know of a way you could suppress this.

                A Offline
                A Offline
                Adam m Nelson
                wrote on last edited by
                #15

                hmm, ok, thanks anyways!! I'll play around with it and if I figure something out I will post it here.

                --Its not broken if it never worked.

                1 Reply Last reply
                0
                • A Adam m Nelson

                  Beautiful, I will try that tonight. If its not too much to ask, I have another quick question: This way of doing it leaves an extra cariage return at the end of the file, i tried writing a \b to the file once it is all done, but it literally writes a \b in the file. Print #FileHandle, "\b" Print #FileHandle, '\b' isn't a command as the ' starts a comment. Is there a way to kill that last cariage return?

                  --Its not broken if it never worked.

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #16

                  Put a semi-colon on the end of the Print statement.

                  Print #FileHandle, "something...";

                  This will avoid adding a CRLF to the end of the line it just printed to the file.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  A 2 Replies Last reply
                  0
                  • D Dave Kreskowiak

                    Put a semi-colon on the end of the Print statement.

                    Print #FileHandle, "something...";

                    This will avoid adding a CRLF to the end of the line it just printed to the file.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008

                    A Offline
                    A Offline
                    Adam m Nelson
                    wrote on last edited by
                    #17

                    Hey hey that did it!, however because i am writing to the file inside of a loop there are no line breaks now. Is there a command I can put at the beginning of the string being written to the file to tell it to create a new line?

                    --Its not broken if it never worked.

                    1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      Put a semi-colon on the end of the Print statement.

                      Print #FileHandle, "something...";

                      This will avoid adding a CRLF to the end of the line it just printed to the file.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008

                      A Offline
                      A Offline
                      Adam m Nelson
                      wrote on last edited by
                      #18

                      Actually, never mind, i re-worked the loop to work around it. Thanks a bunch everyone!! ;)

                      --Its not broken if it never worked.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups