I don't know how to use that...I'm a real newbe...
This is what I have done and whant to do(it does not realy work...
*** marks questions and remarks
This is what I need to do:
This is in the InternetClass:
'**** I am making MyArray here
Public Function FromFile()
Dim X As Long
Dim FileNum As Long
Dim TotalFile As String
Dim MyArray() As String
FileNum = FreeFile
' Reads the entire file into memory all at once
Open "c:\testfile.txt" For Binary As #FileNum
TotalFile = Space(LOF(FileNum))
Get #FileNum, , TotalFile
Close #FileNum
' Replace all newline character sequences with commas
' This will create a long file with every item separated
' by a comma in the same order as presently in file
TotalFile = Replace$(TotalFile, vbNewLine, ",")
' Split the enormous single string at the commas and puts it in an Array
MyArray = Split(TotalFile, ",")
End Function
***** In the MS Agent Class I have this function:
Dim objInternet As New InternetClass
Private Sub InitAgentCommands()
' Purpose: Initialize the Commands menu
On Error Resume Next
Merlin.Commands.RemoveAll
Merlin.Commands.Caption = "My Menu Name"
Merlin.Commands.Add "ACO", "Advanced Character Options", "Advanced
Character Options"
Merlin.Commands.Add "SPEECHCP", "Speech Control Panel", "[Open] Speech
Control Panel"
Merlin.Commands.Add "SEP1", "______________________________", ""
Merlin.Commands.Add "Jonas Musik", "Jonas Musik", "Jonas Musik"
Merlin.Commands.Add "Read copy", "read copy", "read copy"
Merlin.Commands.Add "SEP2", "______________________________", ""
'****This must take the array made in the InternetClass under the Function
FromFile()
'****and use it here, How do I do that??? (I can't get the data from MyArray
I cant even use MyArray here...)
For X = 0 To UBound(objInternet.MyArray) Step 2
'URLAddress ís MyArray(X) I will use this in an other place.
'NameAddress Is MyArray(X + 1)
Merlin.Commands.Add objInternet.MyArray(X + 1), objInternet.MyArray(X + 1),
objInternet.MyArray(X + 1)
Next
Merlin.Commands.Add "Back", "Back", "Back"
Merlin.Commands.Add "Forward", "Forward", "Forward"
Merlin.Commands.Add "Close", "Close", "Close"
End Sub
"Larry Serflaten" <Abuse@SpamBusters.com> skrev i meddelandet
news:400d834a_2@corp.newsgroups.com...[color=blue]
> "BadOmen" <badomen02@hotmail.com> wrote[color=green]
> > I have made an array in a function in a Class now I need to get to that
> > Array from an other function in an other Class, How do I do that?
> >
> > The Array has no fixed size as it is dependent on how much a user has[/color][/color]
put in[color=blue][color=green]
> > a txt file.[/color]
>
> You should redesign your class so that you do not need to expose the[/color]
array.[color=blue]
> You might even make the array a collection which you would be able to
> expose, if you really need to expose it.
>
> What if you had these in your internet class:
>
> Public Sub Addresses(ByVal Index As Long, Name as String, URL as String)
> If Index >= LBound(MyArray) And Index <= UBound(MyArray) \ 2 Then
> URL = MyArray(Index * 2)
> Name = MyArray(Index * 2 + 1)
> End if
> End Sub
>
> Public Function TotalCommands() As Long
> TotalCommands = UBound(MyArray) \ 2
> End Function
>
>
> You could then loop through them elsewhere:
>
> Dim x&, nam$, url$
>
> For X = 0 to objIE.TotalCommands
> ObjIE.Addresses x, nam, url
> Merlin.Commands.Add nam, nam, nam
> Next
>
> (All untested code but you might get the idea)
> LFS
>
>
>
>
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 100,000 Newsgroups - 19 Different Servers! =-----[/color]