Loading ...
Sorry, an error occurred while loading the content.
 

Re: [libertybasic] Opening and Saving Coding

Expand Messages
  • Brad and Anna Moore
    You know you have to do more to save than simply open a common control (the file dialog window) as a save window - do you not? After the dialog returns back
    Message 1 of 3 , Feb 28, 2003
      You know you have to do more to save than simply open a common control (the
      file dialog window) as a save window - do you not? After the dialog returns
      back to your code it should have a filename (presuming the user did not
      cancel). You want to OPEN that file as OUTPUT, the procede to write each
      line of code out to the file you have opened. The same is true with save as
      function. Before you actually write your save as file, you might use the
      Files command to see if the proposed new filename exists and if it does then
      warn the user.

      Your open code should work fine, and assuming you are reading the file where
      you say "do stuff" then you should have something to read once you fix that
      saving part.

      Brad
      ----- Original Message -----
      From: <xtremeunknown@...>
      To: <libertybasic@yahoogroups.com>
      Sent: Saturday, March 01, 2003 4:55 AM
      Subject: [libertybasic] Opening and Saving Coding


      > Here is the piece of coding I am using for Open, Save and Save As;
      >
      > -----
      > [asOpen]
      > FileDialog "Open text file","*.txt", fileName$
      > If fileName$<>"" Then
      > Open fileName$ For Input As #f
      > 'do stuff
      > Close #f
      > Else
      > Notice "No file chosen!"
      > End If
      > Wait
      >
      > [asSave]
      > 'will have buttons that say SAVE and CANCEL:
      > FileDialog "Save...", "*.txt", fileName$
      > Wait
      >
      > [asSaveAs]
      > 'will have buttons that say SAVE and CANCEL:
      > FileDialog "Save As...", "*.txt", fileName$
      > Wait
      > -----
      >
      > Could someone please help me with these scripts...I am having
      > problems and its it only frustrating me day by day. When I try to
      > open the file, it lets me but nothing shows up. Same thing with Save
      > and Save As, it acts like it going to Save, but in the end it
      > doesnt. Help would be greatly appreciated. =D
      >
      >
      > To unsubscribe from this group, send an email to:
      > libertybasic-unsubscribe@egroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
      >
    • lt_moerder <xtremeunknown@2xtremegaming.
      Here is the piece of coding I am using for Open, Save and Save As; ... [asOpen] FileDialog Open text file , *.txt , fileName$ If fileName$ Then Open
      Message 2 of 3 , Mar 1, 2003
        Here is the piece of coding I am using for Open, Save and Save As;

        -----
        [asOpen]
        FileDialog "Open text file","*.txt", fileName$
        If fileName$<>"" Then
        Open fileName$ For Input As #f
        'do stuff
        Close #f
        Else
        Notice "No file chosen!"
        End If
        Wait

        [asSave]
        'will have buttons that say SAVE and CANCEL:
        FileDialog "Save...", "*.txt", fileName$
        Wait

        [asSaveAs]
        'will have buttons that say SAVE and CANCEL:
        FileDialog "Save As...", "*.txt", fileName$
        Wait
        -----

        Could someone please help me with these scripts...I am having
        problems and its it only frustrating me day by day. When I try to
        open the file, it lets me but nothing shows up. Same thing with Save
        and Save As, it acts like it going to Save, but in the end it
        doesnt. Help would be greatly appreciated. =D
      • skatin_ste <egeditor@hotmail.com>
        [asOpen] FileDialog Open text file , *.txt , fileName$ If fileName$ = then notice No file Chosen! Open fileName$ For Input As #f [Loop] if eof(#f) 0
        Message 3 of 3 , Mar 1, 2003
          [asOpen]
          FileDialog "Open text file","*.txt", fileName$
          If fileName$ = "" then notice "No file Chosen!"
          Open fileName$ For Input As #f
          [Loop]

          if eof(#f) <> 0 then [Quit]

          input #f, item$
          print #your.textbox.in.program, item$
          goto [Loop]

          Wait

          This code should open your chosen text file and display it into a
          textbox, which you will have to add in a window. It looks quite neat
          like that. As for the '[asSave]' and '[asSaveAs]' procedures its
          hard to make some code to perform what you want to do. If you sort
          out a File menu in your program with Save and then add code to this
          to tell the program to copy the data to a text file. Is it text you
          want to save and will they be program settings or anything like
          that? If you'd like some code for that I could make some up for you.
          But I hope I've helped with opening a text file anyway.

          Just put the code in your program and
          change '#your.textbox.in.program' to whatever your textbox name is.
          I'm a bit rusty with things though as I've not done much LB recently.

          Stephen : )
        Your message has been successfully submitted and would be delivered to recipients shortly.