473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

arraylist to use in another form

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
Apr 9 '06 #1
7 3411
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.

Apr 9 '06 #2
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
Apr 9 '06 #3
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
Apr 9 '06 #4
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" <al**********@shotmail.com> schreef in bericht
news:ow****************************@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

Apr 10 '06 #5
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:
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" <al**********@shotmail.com> schreef in bericht
news:ow****************************@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

Apr 12 '06 #6
Hmmm... "Xerebrus" is a nice name too ! Thanks for that new nick, Al,
it's cool ! LOL !

Regards,

Apr 12 '06 #7
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
Apr 12 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Vanessa | last post by:
Hi, I would like to know whether there's any way for me to pass an object by reference to another form? Regards Vanessa
1
by: David | last post by:
Hi, I have a form which requires Serial Numbers to be loaded from another form. When I press a button, another form opens with a list of Serial Numbers. I have the record selectors enabled. ...
1
by: John Phelan-Cummings | last post by:
I'm not certain if this made the post. Sorry if it's a repeat: Using a Button to take an autonumber from one form to populate another autonumber field on another form. I have a Mainform "A"...
2
by: Dean Slindee | last post by:
I have two different independent forms that need to talk to one another to syncronize their displays. Is there a shorter way of referring to another form's controls/events than creating a class...
6
by: Roger Ries via DotNetMonster.com | last post by:
I'm trying to change the text in a label from another form. lblInfo.Text = "ABC" Works for the form your currently in but how the heck do you change that label information from another form. ...
6
by: Leszek | last post by:
Hi. I wrote a script: function zmiana(ile){ while(document.getElementById('accomp').childNodes.length>1){ ostatni=document.getElementById('document.dane.accomp').lastChild;...
0
by: jgrob3 | last post by:
I have a form which contains two subforms: and . The two subforms each have a SQL query to display their results in datasheet view and allow the user to tick which items have been billed. ...
3
by: feeman | last post by:
What I am looking at doing is I have a couple of forms, when I enter the number of products been despatched on the order form, it then creates a record in the transaction table and also the product...
1
by: menyki | last post by:
How do i declare a variable in a form if i want to reference to the variable from another form. Below is a code on a form called updatemortalityForm, some variable on this form, i want to make use of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.