Click to See Complete Forum and Search --> : how do u display multiple occurences of an object


Mathie
03-09-2006, 08:26 AM
Hello. I was wondering if anyone could help me by telling me how in the world you do this:

i have made a class named Business that has several properties (name, address, phone number....) and that works. what i want to do now is i want to try and find a way to show all of the instances of that objects parameters on the webform,. i need a way to to have some sort of loop that can allow me to enter in all the data on the screen, sort of like this:

Name (business objext 1)
Address
Phone Number
City, zipcode
----------------
Name (business objext 2)
Address
Phone Number
City, zipcode
----------------
........

and keep onm going until all the objexts have been shown. i dont initially know how many there are goin to be since each search brings back a different amount (from an XML feed). if someone could please helkp me that would be great thank you!

sirpelidor
03-09-2006, 02:29 PM
what i want to do now is i want to try and find a way to show all of the instances of that objects parameters on the webform



i need a way to to have some sort of loop that can allow me to enter in all the data on the screen and keep onm going until all the objexts have been shown


Hi, I'm not exactly sure if I understand your question, but based on my experience, I'm guessing you want something like this:


class business{
//property codes ommited
public overrides toString() {
return this.name + " " + this.address + " " + this.phone //and so on...
}//end tostring
}//end class


but you also mentioned something about "you don't like how many data in a object, and you want to loop through it" (this is the part i'm very confuse)

I'm guessing you are looking for some sort of enumeration? (have a enumeration hold all the properties in your object, and make 2 methods, 1 to set all methods to your local properties and 1 is return values like my toString example I just showed you)

Hope this get u 1 step closer to the solution...