gettingstarted
[Top] [All Lists]

Re: Reading in text from a file into a ListBox with 2 columns

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Reading in text from a file into a ListBox with 2 columns
From: Phil Heycock <pheycock at bellsouth dot net>
Date: Sun, 30 Jan 2005 23:08:06 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
Try calling 'getPlist' from the open event of 'PlistClass'.

P.
*********************************************
on 1/30/05 6:02 PM, Paul Young at youngpr at myactv dot net wrote:

> Phil,
> 
> I titled the new Class as "PlistClass" and now it has four methods:
> concatenateRow, getPlist, savePlist and writeToTextFile.  All are
> declared Public access.
> 
> I need to call getPlist from App/Event/Open but the debugger tells me
> getPlist does not exist, even though I use "PlistClass.getPlist"   What
> am I missing?
> 
> Thanks,
> 
> Paul
> 
> 
> On Jan 29, 2005, at 10:32 PM, Phil Heycock wrote:
> 
>> Hi, Paul,
>> 
>> Taking this a step further, consider making the 'write-to-file' a part
>> of
>> the custom ListBox class functionality, as well. Add another method:
>> 
>> Sub writeToTextFile(t As TextOutputStream)
>>     Dim row As Integer
>>     // Write the first row to file
>>     t.WriteLine concatenateRow(row) // row is zero (0) here
>>     // Write the remaining rows, if any... delimited
>>     For row = 1 To ListCount - 1
>>         t.WriteLine EndOfLine + concatenateRow(row)
>>     next
>> End Sub
>> 
>> Your PushButton.Action event would contain this code, calling a method
>> ('saveListBox') in the Window:
>> 
>> Sub Action()
>>     If ListBox1.ListCount > 0 Then
>>         saveListBox
>>     Else
>>         Beep
>>         MsgBox "The ListBox is empty. Nothing to save."
>>     End If
>> End Sub
>> 
>> Sub saveListBox ()
>> 
>>     dim f as FolderItem = PreferencesFolder.Child("filename.plist")
>>     dim t as TextOutputStream = f.CreateTextFile
>> 
>>     If t <> nil Then
>>         ListBox1.writeToTextFile t
>>         t.close
>>     Else
>>         Beep
>>         MsgBox "File not opened. Nothing saved."
>>     End If
>> 
>> End Sub
>> 
>> 
>>>> Function contatenateRow(row As Integer) As String
>>>>     Dim col As Integer
>>>>     Dim rowTxt As String = Cell(row, col) // col is zero (0) here
>>>>     For col = 1 To ColumnCount - 1
>>>>         rowTxt = rowTxt + HT + Cell(row, col)
>>>>     Next
>>>>     Return rowTxt
>>>> End Function


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

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

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