gettingstarted
[Top] [All Lists]

Re: Saving data to an external file

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Saving data to an external file
From: Terry Ford <tmford at shaw dot ca>
Date: Sun, 30 Jul 2006 19:16:15 -0700
Delivered-to: listarchive at realsoftware dot com
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <20060731004201 dot 10804 dot qmail at web60420 dot mail dot yahoo dot com>

On Jul 30, 2006, at 5:42 PM, Lennox Jacob wrote:

Hello,
I have a Pushbutton named Export, which,when clicked, I would like it to export data (EF1.text, EF2.text, EF3.text, EF4.text) from some chosen editfields (EF1, EF2, EF3, EF4) to a new text file on the desktop.
Not Save or SaveAs like when the whole document is saved.
How is that done?

Assuming these are single line editfields and that an EndOfLine separator is adequate:

  Dim f As FolderItem
  Dim tOS As TextOutputStream

  f=DesktopFolder.Child("[your file name here]")
  tOS=f.CreateTextFile
  tOS.WriteLine EF1.Text
  tOS.WriteLine EF2.Text
  tOS.WriteLine EF3.Text
  tOS.WriteLine EF4.Text
  tOS.Close


To read this back into the editfields:

  Dim f As FolderItem
  Dim tIS As TextInputStream

  f=DesktopFolder.Child("[your file name here]")
  tIS=f.OpenAsTextFile
  EF1.Text=tIS.ReadLine
  EF2.Text=tIS.ReadLine
  EF3.Text=tIS.ReadLine
  EF4.Text=tIS.ReadLine
  tIS.Close

Terry

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>