PC Review


Reply
Thread Tools Rate Thread

calling objects method

 
 
rocco
Guest
Posts: n/a
 
      5th Apr 2010
Hello,
I have a collection of objects. Each object has few properties and few
methods, among which: save, delete, recall and others.
The "save" method of each object runs few private class functions to double
check data and if everything is fine it adds the data collected in few tables.
I would need a way to iterate the objects in the Collection (and I know how
to do this) and call for each of them the "save" method. Is this possible?
Hoping first it is clear...

Thanks,
Rocco
 
Reply With Quote
 
 
 
 
rocco
Guest
Posts: n/a
 
      5th Apr 2010
it should be:
myCollectionName.Item(itemIndex).Save

....I guess...

"rocco" wrote:

> Hello,
> I have a collection of objects. Each object has few properties and few
> methods, among which: save, delete, recall and others.
> The "save" method of each object runs few private class functions to double
> check data and if everything is fine it adds the data collected in few tables.
> I would need a way to iterate the objects in the Collection (and I know how
> to do this) and call for each of them the "save" method. Is this possible?
> Hoping first it is clear...
>
> Thanks,
> Rocco

 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      5th Apr 2010
Hi,
yes, it should work, something like this:

dim o as object
for each o in MyCollection
o.Save
next o

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"rocco" <(E-Mail Removed)> wrote in message
news:F5A7DCF9-825E-4EF1-9B27-(E-Mail Removed)...
> Hello,
> I have a collection of objects. Each object has few properties and few
> methods, among which: save, delete, recall and others.
> The "save" method of each object runs few private class functions to
> double
> check data and if everything is fine it adds the data collected in few
> tables.
> I would need a way to iterate the objects in the Collection (and I know
> how
> to do this) and call for each of them the "save" method. Is this possible?
> Hoping first it is clear...
>
> Thanks,
> Rocco


 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      5th Apr 2010
"rocco" <(E-Mail Removed)> wrote in message
news:531AC139-8865-4705-95A9-(E-Mail Removed)...
> it should be:
> myCollectionName.Item(itemIndex).Save
>
> ...I guess...
>
> "rocco" wrote:
>
>> Hello,
>> I have a collection of objects. Each object has few properties and few
>> methods, among which: save, delete, recall and others.
>> The "save" method of each object runs few private class functions to
>> double
>> check data and if everything is fine it adds the data collected in few
>> tables.
>> I would need a way to iterate the objects in the Collection (and I know
>> how
>> to do this) and call for each of them the "save" method. Is this
>> possible?



That would work. Or you could write:

Dim obj As Object

For Each obj In myCollectionName
obj.Save
Next obj

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
rocco
Guest
Posts: n/a
 
      5th Apr 2010
I like your solution better. As usual.

Thanks!

Rocco

"Dirk Goldgar" wrote:

> "rocco" <(E-Mail Removed)> wrote in message
> news:531AC139-8865-4705-95A9-(E-Mail Removed)...
> > it should be:
> > myCollectionName.Item(itemIndex).Save
> >
> > ...I guess...
> >
> > "rocco" wrote:
> >
> >> Hello,
> >> I have a collection of objects. Each object has few properties and few
> >> methods, among which: save, delete, recall and others.
> >> The "save" method of each object runs few private class functions to
> >> double
> >> check data and if everything is fine it adds the data collected in few
> >> tables.
> >> I would need a way to iterate the objects in the Collection (and I know
> >> how
> >> to do this) and call for each of them the "save" method. Is this
> >> possible?

>
>
> That would work. Or you could write:
>
> Dim obj As Object
>
> For Each obj In myCollectionName
> obj.Save
> Next obj
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method Signature For A Method That Can Return Objects and PrimitiveData Types... Sunburned Surveyor Microsoft C# .NET 15 21st Dec 2007 06:59 PM
CLI and calling the base method from the derived method DaTurk Microsoft VC .NET 2 11th Jul 2007 11:29 PM
Can a method know the name of the calling class & method? ssg31415926 Microsoft C# .NET 4 24th Dec 2006 03:12 PM
How to identify the calling method of a method Rakehs Microsoft C# .NET 8 1st Dec 2003 07:35 AM
Calling protected method from interface that doesn't include method Jon Shemitz Microsoft C# .NET 2 25th Nov 2003 11:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:21 PM.