Home All Groups Group Topic Archive Search About

arraylist to use in another form

Author
9 Apr 2006 4:23 PM
al jones
I'm not seeing things right today.  I have an arraylist I create and load
in one form.  To display the information from the array list I'm opening a
richtextbox in another form - stupid time - how do I pass the array list to
the load function of the new form??

//al

Author
9 Apr 2006 3:46 PM
Chris
al jones wrote:
> I'm not seeing things right today.  I have an arraylist I create and load
> in one form.  To display the information from the array list I'm opening a
> richtextbox in another form - stupid time - how do I pass the array list to
> the load function of the new form??
>
> //al

Class FormArrayListPassing
    dim mArrayList as ArrayList
    sub New(iArrayList as ArrayList)
        initializeComponents
        mArrayList = iArrayList
    end sub
End Class
Author
9 Apr 2006 4:37 PM
Cerebrus
Well...

Might be a hundred ways to do this... Don't worry I won't and can't
enumerate all hundred ;-)

1. Create a Public property of type Arraylist within the New form.
Before showing this newForm, set the value of the property to your
ArrayList.

2. Create an overloaded Sub New procedure (constructor) for your New
form, which accepts an ArrayList as parameter. Then call that method
instead of the usual constructor.

Rest of the 98 ways... umm... maybe next time ? lolz

Regards,

Cerebrus.
Author
9 Apr 2006 8:24 PM
al jones
On Sun, 09 Apr 2006 16:23:39 GMT, al jones wrote:

> I'm not seeing things right today.  I have an arraylist I create and load
> in one form.  To display the information from the array list I'm opening a
> richtextbox in another form - stupid time - how do I pass the array list to
> the load function of the new form??
>
> //al

I'm not really talking to myself - thank you both.  Once I see what your
code does Chris (thanks to Marks suggestion) it makes sense. 

There are days I'd love to go back to the simplicity of codeing COBOL for a
mainframe - and then there are days where I'd gladly drop every computer I
have off the top of the Eiffel Tower!

Thank you both //al
Author
10 Apr 2006 6:36 AM
Cor Ligthert [MVP]
Al in the same way as you would do it in Cobol if that was a Call by
overloading the Sub New in your second form.

But mostly is it easier to make in this case your arraylist friend in form 1
Set a property in your second form and than use that (it can as well with a
field, in the way I show it you here quick and dirty)

Form1
Friend MyArrayList as new arraylist

Form2
Friend myArrayList as arraylist

Form1 procedure
dim frm2 as Form2
frm2.myArrayList = me.myArraylist
frm2.show
'I prefer this with
frm2.showdialog, with the show you can get complications.

I hope this helps,

Cor


Show quoteHide quote
"al jones" <alfredmjo***@shotmail.com> schreef in bericht
news:ow6fdqqrx4pc.14szeo14trxi3.dlg@40tude.net...
> I'm not seeing things right today.  I have an arraylist I create and load
> in one form.  To display the information from the array list I'm opening a
> richtextbox in another form - stupid time - how do I pass the array list
> to
> the load function of the new form??
>
> //al
Author
12 Apr 2006 3:47 AM
al jones
Cor, as Xerebus said, there are probably 100 different ways to do it... I
like yours, but had already used his (which works).

Thanks for the additional education ...

The last COBOL *I* wrote was something like COBOL 74 (on an HP series 3) -
it was all single (as I recall) programs, there was no call yet,  that came
about in COBOL 80 (or later), didn't it??

//al


On Mon, 10 Apr 2006 08:36:01 +0200, Cor Ligthert [MVP] wrote:

Show quoteHide quote
> Al in the same way as you would do it in Cobol if that was a Call by
> overloading the Sub New in your second form.
>
> But mostly is it easier to make in this case your arraylist friend in form 1
> Set a property in your second form and than use that (it can as well with a
> field, in the way I show it you here quick and dirty)
>
> Form1
> Friend MyArrayList as new arraylist
>
> Form2
> Friend myArrayList as arraylist
>
> Form1 procedure
> dim frm2 as Form2
> frm2.myArrayList = me.myArraylist
> frm2.show
> 'I prefer this with
> frm2.showdialog, with the show you can get complications.
>
> I hope this helps,
>
> Cor
>
> "al jones" <alfredmjo***@shotmail.com> schreef in bericht
> news:ow6fdqqrx4pc.14szeo14trxi3.dlg@40tude.net...
>> I'm not seeing things right today.  I have an arraylist I create and load
>> in one form.  To display the information from the array list I'm opening a
>> richtextbox in another form - stupid time - how do I pass the array list
>> to
>> the load function of the new form??
>>
>> //al
Author
12 Apr 2006 4:10 AM
Cerebrus
Hmmm... "Xerebrus" is a nice name too ! Thanks for that new nick, Al,
it's cool ! LOL !

Regards,
Author
12 Apr 2006 12:11 PM
al jones
On 11 Apr 2006 21:10:59 -0700, Cerebrus wrote:

> Hmmm... "Xerebrus" is a nice name too ! Thanks for that new nick, Al,
> it's cool ! LOL !
>
> Regards,

<chuckle> Oops, sorry guy, it as getting late and I was thinking about
getting my old bod to bed - slippery fingers and all that.  Glad you like
the alternative form, but did you notice that you also further altered it??

//al