Jack,
That's exactly what I need. Thank you very much.
Chuck
On Apr 14, 2006, at 10:21 PM, CV wrote:
I want to subclass FolderItem (or maybe TextInputStream, I'm not
sure) and add a LineCount method to it. There are a number of
places where I need to know how many lines a text file has.
However, the way I'm doing this doesn't seem to work. For
instance, if I subclass FolderItem as MyFolderItem and add a
LineCount method to it, how do I use it when the built-in classes
return FolderItems? First I tried casting:
dim newFile as new FolderItem = App.AppSupportFolder.Child(fileName)
dim lines as Integer = MyFolderItem(newFile).LineCount
But I got an illegal cast error at compile. Then I tried to dim
newFile as a MyFolderItem, but RB won't let me assign the results
of the Child method to anything but a FolderItem.
Is there a better way to do this?
Or you could use Extends. In a module:
Function LineCount(Extends f as folderItem) As integer
dim Result as integer
// do something
Return Result
End Function
f = // whatever folder item
msgbox str(f.LineCount) // displays Result
Best,
Jack
_______________________________________________
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>