473,326 Members | 2,113 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,326 software developers and data experts.

Microsoft.VisualBasic.Collection replacement?

Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an
index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I
suppose I could iterate thru the collection and look for a string match, but
I thought there might be an easier way.

Thanks,

Craig
Nov 20 '05 #1
34 5614
Hi,

Take a look at the hashtable.

Ken
---------------
"Craig Buchanan" <so*****@microsoft.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an
index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I
suppose I could iterate thru the collection and look for a string match, but I thought there might be an easier way.

Thanks,

Craig

Nov 20 '05 #2
Hi,

Take a look at the hashtable.

Ken
---------------
"Craig Buchanan" <so*****@microsoft.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an
index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I
suppose I could iterate thru the collection and look for a string match, but I thought there might be an easier way.

Thanks,

Craig

Nov 20 '05 #3
"Craig Buchanan" <so*****@microsoft.com> schrieb
Which vb.net object is the best match for the vb6 collection
class? Specifically, I would like to be able to access the Item
property with an index or a key string.

I wrote my own class that inherits from the collectionbase and uses
an arraylist to hold values, but i'm missing the Item(string)
property. I suppose I could iterate thru the collection and look for
a string match, but I thought there might be an easier way.


Microsoft.VisualBasic.Collection is not a part of VB6, it's a part of VB.NET
and the Framework. You can use it. It is not part of the compatibility
library that is only there for compatibility reasons.


--
Armin

Nov 20 '05 #4
"Craig Buchanan" <so*****@microsoft.com> schrieb
Which vb.net object is the best match for the vb6 collection
class? Specifically, I would like to be able to access the Item
property with an index or a key string.

I wrote my own class that inherits from the collectionbase and uses
an arraylist to hold values, but i'm missing the Item(string)
property. I suppose I could iterate thru the collection and look for
a string match, but I thought there might be an easier way.


Microsoft.VisualBasic.Collection is not a part of VB6, it's a part of VB.NET
and the Framework. You can use it. It is not part of the compatibility
library that is only there for compatibility reasons.


--
Armin

Nov 20 '05 #5
Hi Armin

I don't think it is just Craig who shies away from the Microsoft.VisualBasic
namespace. Perhaps it is the Compatibility namespace that has given it a bad
name, but I also have been reluctant to use its methods.

The .NET classes and methods have a subtly different feel to them, whilst
the VisualBasic namespace retains classic VB names that make one feel that
they are in some way retro.

I have seen many posts from people who believe that these are old-style
functions that are present for compatibility reasons, and that somewhere
there must be newer, 'true' framework versions.

I am coming to the conclusion that this is not the case, but it is perhaps
odd that so many people have been labouring under the same misapprehension.

Charles
"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"Craig Buchanan" <so*****@microsoft.com> schrieb
Which vb.net object is the best match for the vb6 collection
class? Specifically, I would like to be able to access the Item
property with an index or a key string.

I wrote my own class that inherits from the collectionbase and uses
an arraylist to hold values, but i'm missing the Item(string)
property. I suppose I could iterate thru the collection and look for
a string match, but I thought there might be an easier way.
Microsoft.VisualBasic.Collection is not a part of VB6, it's a part of

VB.NET and the Framework. You can use it. It is not part of the compatibility
library that is only there for compatibility reasons.


--
Armin

Nov 20 '05 #6
Hi Armin

I don't think it is just Craig who shies away from the Microsoft.VisualBasic
namespace. Perhaps it is the Compatibility namespace that has given it a bad
name, but I also have been reluctant to use its methods.

The .NET classes and methods have a subtly different feel to them, whilst
the VisualBasic namespace retains classic VB names that make one feel that
they are in some way retro.

I have seen many posts from people who believe that these are old-style
functions that are present for compatibility reasons, and that somewhere
there must be newer, 'true' framework versions.

I am coming to the conclusion that this is not the case, but it is perhaps
odd that so many people have been labouring under the same misapprehension.

Charles
"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"Craig Buchanan" <so*****@microsoft.com> schrieb
Which vb.net object is the best match for the vb6 collection
class? Specifically, I would like to be able to access the Item
property with an index or a key string.

I wrote my own class that inherits from the collectionbase and uses
an arraylist to hold values, but i'm missing the Item(string)
property. I suppose I could iterate thru the collection and look for
a string match, but I thought there might be an easier way.
Microsoft.VisualBasic.Collection is not a part of VB6, it's a part of

VB.NET and the Framework. You can use it. It is not part of the compatibility
library that is only there for compatibility reasons.


--
Armin

Nov 20 '05 #7
Craig,
As the others have suggested you could continue to use
Microsoft.VisualBasic.Collection.

Alternatively you can start with CollectionBase and add a contained
HashTable, or start with DictionaryBase and add a contained ArrayList. Then
simply add two Item properties one for Integer & one for String.

A Third "better" alternative may be to start with
System.Collections.Specialized.NameObjectCollectio nBase and add two Item
properties.

There are a couple of other collections (NameValueCollection for example) in
System.Collections.Specialized that may be useful also.

I prefer to start with CollectionBase, DictionaryBase, or
NameObjectCollectionBase as they allow me to have type safe collections!

Hope this helps
Jay

"Craig Buchanan" <so*****@microsoft.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an
index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I
suppose I could iterate thru the collection and look for a string match, but I thought there might be an easier way.

Thanks,

Craig

Nov 20 '05 #8
Craig,
As the others have suggested you could continue to use
Microsoft.VisualBasic.Collection.

Alternatively you can start with CollectionBase and add a contained
HashTable, or start with DictionaryBase and add a contained ArrayList. Then
simply add two Item properties one for Integer & one for String.

A Third "better" alternative may be to start with
System.Collections.Specialized.NameObjectCollectio nBase and add two Item
properties.

There are a couple of other collections (NameValueCollection for example) in
System.Collections.Specialized that may be useful also.

I prefer to start with CollectionBase, DictionaryBase, or
NameObjectCollectionBase as they allow me to have type safe collections!

Hope this helps
Jay

"Craig Buchanan" <so*****@microsoft.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an
index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I
suppose I could iterate thru the collection and look for a string match, but I thought there might be an easier way.

Thanks,

Craig

Nov 20 '05 #9
Cor
Hi Craig and all others,

I am like Armin with the ones who always say that the Microsoft.Visual basic
namespace is not for compatible reasons. However, I did wish they had placed
the Microsoft.Visualbasic collection in the compatible namespace. In my
opinion, it is so very different from all what is used in dotNet that you
have to investigate time in it and always have to keep track of those
specialities it has.

As an addition to Ken, Jay and your own method, which is the way I too would
go in the start, is that I more and more use the datatable. There is so much
in that class, that using the Ilist derived classes and the Icomparer needs
a lot of time to create things, while that is done with the datatable mostly
in one or two lines.
Just my thought,

Cor

Nov 20 '05 #10
Cor
Hi Craig and all others,

I am like Armin with the ones who always say that the Microsoft.Visual basic
namespace is not for compatible reasons. However, I did wish they had placed
the Microsoft.Visualbasic collection in the compatible namespace. In my
opinion, it is so very different from all what is used in dotNet that you
have to investigate time in it and always have to keep track of those
specialities it has.

As an addition to Ken, Jay and your own method, which is the way I too would
go in the start, is that I more and more use the datatable. There is so much
in that class, that using the Ilist derived classes and the Icomparer needs
a lot of time to create things, while that is done with the datatable mostly
in one or two lines.
Just my thought,

Cor

Nov 20 '05 #11
Hi Jay

I'm not really trying to hijack this thread, but it continues to touch on
areas that currently concern me as well.

With respect to the specific question of collections, I too have been
looking for a ready-made collection that supports key and item, is sortable,
but can also be serialised using the XML serialiser. Whilst the suggestions
you make separately fulfil parts of these goals, I don't think any one of
them is the full Monty (e.g. anything using IDictionary cannot be
automatically serialised) ... but I may be wrong.

Can you suggest a solution with these aims in mind?

Thanks.

Charles
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
Craig,
As the others have suggested you could continue to use
Microsoft.VisualBasic.Collection.

Alternatively you can start with CollectionBase and add a contained
HashTable, or start with DictionaryBase and add a contained ArrayList. Then simply add two Item properties one for Integer & one for String.

A Third "better" alternative may be to start with
System.Collections.Specialized.NameObjectCollectio nBase and add two Item
properties.

There are a couple of other collections (NameValueCollection for example) in System.Collections.Specialized that may be useful also.

I prefer to start with CollectionBase, DictionaryBase, or
NameObjectCollectionBase as they allow me to have type safe collections!

Hope this helps
Jay

"Craig Buchanan" <so*****@microsoft.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I
suppose I could iterate thru the collection and look for a string match,

but
I thought there might be an easier way.

Thanks,

Craig


Nov 20 '05 #12
Hi Jay

I'm not really trying to hijack this thread, but it continues to touch on
areas that currently concern me as well.

With respect to the specific question of collections, I too have been
looking for a ready-made collection that supports key and item, is sortable,
but can also be serialised using the XML serialiser. Whilst the suggestions
you make separately fulfil parts of these goals, I don't think any one of
them is the full Monty (e.g. anything using IDictionary cannot be
automatically serialised) ... but I may be wrong.

Can you suggest a solution with these aims in mind?

Thanks.

Charles
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
Craig,
As the others have suggested you could continue to use
Microsoft.VisualBasic.Collection.

Alternatively you can start with CollectionBase and add a contained
HashTable, or start with DictionaryBase and add a contained ArrayList. Then simply add two Item properties one for Integer & one for String.

A Third "better" alternative may be to start with
System.Collections.Specialized.NameObjectCollectio nBase and add two Item
properties.

There are a couple of other collections (NameValueCollection for example) in System.Collections.Specialized that may be useful also.

I prefer to start with CollectionBase, DictionaryBase, or
NameObjectCollectionBase as they allow me to have type safe collections!

Hope this helps
Jay

"Craig Buchanan" <so*****@microsoft.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I
suppose I could iterate thru the collection and look for a string match,

but
I thought there might be an easier way.

Thanks,

Craig


Nov 20 '05 #13
Cor
Hi Charles,

What is against the dataset it has everything you are asking for build in in
my opinion?

Cor
Nov 20 '05 #14
Cor
Hi Charles,

What is against the dataset it has everything you are asking for build in in
my opinion?

Cor
Nov 20 '05 #15
Hi Cor

I hadn't thought of the dataset, I suppose because I tend to think of it
more as a database orientated class, but I will take a look now.

Thanks

Charles
"Cor" <no*@non.com> wrote in message
news:O9**************@TK2MSFTNGP12.phx.gbl...
Hi Charles,

What is against the dataset it has everything you are asking for build in in my opinion?

Cor

Nov 20 '05 #16
Hi Cor

I hadn't thought of the dataset, I suppose because I tend to think of it
more as a database orientated class, but I will take a look now.

Thanks

Charles
"Cor" <no*@non.com> wrote in message
news:O9**************@TK2MSFTNGP12.phx.gbl...
Hi Charles,

What is against the dataset it has everything you are asking for build in in my opinion?

Cor

Nov 20 '05 #17
Charles,
Unfortunately I do not do a lot of XML serialization, so I currently do not
have an answer for you, other then what I stated in the other thread.

Also are you referring to the XML serializer or the SOAP serializer? They
are different: one is used the same as BinarySerilazer, while the other is
used for Web Services, my understanding is that the SOAP serializer is more
limited as SOAP is more limited. HOwever I have not done a lot with either
SOAP or XML serialization.

Hope this helps
Jay

"Charles Law" <bl***@nowhere.com> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl...
Hi Jay

I'm not really trying to hijack this thread, but it continues to touch on
areas that currently concern me as well.

With respect to the specific question of collections, I too have been
looking for a ready-made collection that supports key and item, is sortable, but can also be serialised using the XML serialiser. Whilst the suggestions you make separately fulfil parts of these goals, I don't think any one of
them is the full Monty (e.g. anything using IDictionary cannot be
automatically serialised) ... but I may be wrong.

Can you suggest a solution with these aims in mind?

Thanks.

Charles
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
Craig,
As the others have suggested you could continue to use
Microsoft.VisualBasic.Collection.

Alternatively you can start with CollectionBase and add a contained
HashTable, or start with DictionaryBase and add a contained ArrayList. Then
simply add two Item properties one for Integer & one for String.

A Third "better" alternative may be to start with
System.Collections.Specialized.NameObjectCollectio nBase and add two Item
properties.

There are a couple of other collections (NameValueCollection for example) in
System.Collections.Specialized that may be useful also.

I prefer to start with CollectionBase, DictionaryBase, or
NameObjectCollectionBase as they allow me to have type safe collections!

Hope this helps
Jay

"Craig Buchanan" <so*****@microsoft.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I suppose I could iterate thru the collection and look for a string

match, but
I thought there might be an easier way.

Thanks,

Craig



Nov 20 '05 #18
Charles,
Unfortunately I do not do a lot of XML serialization, so I currently do not
have an answer for you, other then what I stated in the other thread.

Also are you referring to the XML serializer or the SOAP serializer? They
are different: one is used the same as BinarySerilazer, while the other is
used for Web Services, my understanding is that the SOAP serializer is more
limited as SOAP is more limited. HOwever I have not done a lot with either
SOAP or XML serialization.

Hope this helps
Jay

"Charles Law" <bl***@nowhere.com> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl...
Hi Jay

I'm not really trying to hijack this thread, but it continues to touch on
areas that currently concern me as well.

With respect to the specific question of collections, I too have been
looking for a ready-made collection that supports key and item, is sortable, but can also be serialised using the XML serialiser. Whilst the suggestions you make separately fulfil parts of these goals, I don't think any one of
them is the full Monty (e.g. anything using IDictionary cannot be
automatically serialised) ... but I may be wrong.

Can you suggest a solution with these aims in mind?

Thanks.

Charles
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
Craig,
As the others have suggested you could continue to use
Microsoft.VisualBasic.Collection.

Alternatively you can start with CollectionBase and add a contained
HashTable, or start with DictionaryBase and add a contained ArrayList. Then
simply add two Item properties one for Integer & one for String.

A Third "better" alternative may be to start with
System.Collections.Specialized.NameObjectCollectio nBase and add two Item
properties.

There are a couple of other collections (NameValueCollection for example) in
System.Collections.Specialized that may be useful also.

I prefer to start with CollectionBase, DictionaryBase, or
NameObjectCollectionBase as they allow me to have type safe collections!

Hope this helps
Jay

"Craig Buchanan" <so*****@microsoft.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
Which vb.net object is the best match for the vb6 collection class?
Specifically, I would like to be able to access the Item property with an index or a key string.

I wrote my own class that inherits from the collectionbase and uses an
arraylist to hold values, but i'm missing the Item(string) property. I suppose I could iterate thru the collection and look for a string

match, but
I thought there might be an easier way.

Thanks,

Craig



Nov 20 '05 #19
Cor,
A Dataset is used to contain a set or Data Rows.

A Collection is used to contain a set of objects.

Being an Object Oriented programmer, I find containing a set of objects is
much more powerful then containing a set of Data rows.

Unfortunately I do not have a good resource on when you should choose a Data
Centric (DataSet) approach or an Object Oriented approach. Although I find
keeping both options available is far better then saying. We are only using
one or the other!

Hope this helps
Jay

"Cor" <no*@non.com> wrote in message
news:O9**************@TK2MSFTNGP12.phx.gbl...
Hi Charles,

What is against the dataset it has everything you are asking for build in in my opinion?

Cor

Nov 20 '05 #20
Cor,
A Dataset is used to contain a set or Data Rows.

A Collection is used to contain a set of objects.

Being an Object Oriented programmer, I find containing a set of objects is
much more powerful then containing a set of Data rows.

Unfortunately I do not have a good resource on when you should choose a Data
Centric (DataSet) approach or an Object Oriented approach. Although I find
keeping both options available is far better then saying. We are only using
one or the other!

Hope this helps
Jay

"Cor" <no*@non.com> wrote in message
news:O9**************@TK2MSFTNGP12.phx.gbl...
Hi Charles,

What is against the dataset it has everything you are asking for build in in my opinion?

Cor

Nov 20 '05 #21
Hi Jay B,

Did you see me giving an answer on Charles last question about the XML
serializer, that is because I agree this with you (I am sad you even do
think I am not).

:-)

However in this thread he was asking about a collection and in my simple
mind it was a collection of data.

So I pointed Charles on the dataset, because that is a very easy collection
when it is all about data.

And I was in doubt if I would look for Charles for the XML serializer
because I did give someone an answer yesterday where that was in. However I
decided to do that this time not. I do not know of the complexebility of the
object Charles wants to serialize (which is mostly simple) and deserialize
(which is mostly difficult) . And because Charles always start telling the
question simple and than comes an "however I am using it in that way", I did
it this time not, but decided to wait for that last one.

:-)

Cor

Nov 20 '05 #22
Hi Jay B,

Did you see me giving an answer on Charles last question about the XML
serializer, that is because I agree this with you (I am sad you even do
think I am not).

:-)

However in this thread he was asking about a collection and in my simple
mind it was a collection of data.

So I pointed Charles on the dataset, because that is a very easy collection
when it is all about data.

And I was in doubt if I would look for Charles for the XML serializer
because I did give someone an answer yesterday where that was in. However I
decided to do that this time not. I do not know of the complexebility of the
object Charles wants to serialize (which is mostly simple) and deserialize
(which is mostly difficult) . And because Charles always start telling the
question simple and than comes an "however I am using it in that way", I did
it this time not, but decided to wait for that last one.

:-)

Cor

Nov 20 '05 #23
Hi Cor

You have found me out ;-) I do tend to keep my questions simple to start
with because I don't want to put people off having a go at answering. I also
cut out all the stuff that I don't think is relevant, and which might set
people thinking of an inappropriate solution.

The serialiser question is a good example. With each post I have added some
extra detail. I generally like to find things out for myself, because I
think I will learn and remember better that way, so I also don't seek for
people to give me the full answer but just a nudge in the right direction.

In this case, though, I have seen many posts on this subject which allude to
the same thing, that there is no direct replacement for the
VisualBasic.Collection. That is a shame, because many people find that it
has exactly what they want from a collection.

As for serialising, I get the impression that not being able to serialise a
class that implements IDictionary (without hand-coding) is a short-coming,
and therefore may be added later by Microsoft. I hope so anyway.

Regards

Charles
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
Hi Jay B,

Did you see me giving an answer on Charles last question about the XML
serializer, that is because I agree this with you (I am sad you even do
think I am not).

:-)

However in this thread he was asking about a collection and in my simple
mind it was a collection of data.

So I pointed Charles on the dataset, because that is a very easy collection when it is all about data.

And I was in doubt if I would look for Charles for the XML serializer
because I did give someone an answer yesterday where that was in. However I decided to do that this time not. I do not know of the complexebility of the object Charles wants to serialize (which is mostly simple) and deserialize
(which is mostly difficult) . And because Charles always start telling the
question simple and than comes an "however I am using it in that way", I did it this time not, but decided to wait for that last one.

:-)

Cor


Nov 20 '05 #24
Hi Cor

You have found me out ;-) I do tend to keep my questions simple to start
with because I don't want to put people off having a go at answering. I also
cut out all the stuff that I don't think is relevant, and which might set
people thinking of an inappropriate solution.

The serialiser question is a good example. With each post I have added some
extra detail. I generally like to find things out for myself, because I
think I will learn and remember better that way, so I also don't seek for
people to give me the full answer but just a nudge in the right direction.

In this case, though, I have seen many posts on this subject which allude to
the same thing, that there is no direct replacement for the
VisualBasic.Collection. That is a shame, because many people find that it
has exactly what they want from a collection.

As for serialising, I get the impression that not being able to serialise a
class that implements IDictionary (without hand-coding) is a short-coming,
and therefore may be added later by Microsoft. I hope so anyway.

Regards

Charles
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
Hi Jay B,

Did you see me giving an answer on Charles last question about the XML
serializer, that is because I agree this with you (I am sad you even do
think I am not).

:-)

However in this thread he was asking about a collection and in my simple
mind it was a collection of data.

So I pointed Charles on the dataset, because that is a very easy collection when it is all about data.

And I was in doubt if I would look for Charles for the XML serializer
because I did give someone an answer yesterday where that was in. However I decided to do that this time not. I do not know of the complexebility of the object Charles wants to serialize (which is mostly simple) and deserialize
(which is mostly difficult) . And because Charles always start telling the
question simple and than comes an "however I am using it in that way", I did it this time not, but decided to wait for that last one.

:-)

Cor


Nov 20 '05 #25
Cor,
I was neither agreeing nor disagreeing with you! At the same time I was both
Agreeing & Disagreeing with you! ;-)

You made a statement, in the form of a question:
What is against the dataset it has everything you are asking
for build in in my opinion?
I was answering the question, The fact a dataset can only hold data rows is
something significant against it.

If you are a Data centric programmer then yes, using a DataSet is fine. So
in this regard I was agreeing with you.

However I find significantly more value in being an Object Oriented
programmer, so a lot of times a DataSet is too limiting. So in this regard I
was disagreeing with you.

Remember Object Oriented thinking involves organizing your app by
responsibility & behaviors, not simply I have a collection of data...

As I stated, using a Data centric approach is appropriate sometimes and
using an Object Oriented approach is appropriate .

Hope this helps
Jay

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl... Hi Jay B,

Did you see me giving an answer on Charles last question about the XML
serializer, that is because I agree this with you (I am sad you even do
think I am not).

:-)

However in this thread he was asking about a collection and in my simple
mind it was a collection of data.

So I pointed Charles on the dataset, because that is a very easy collection when it is all about data.

And I was in doubt if I would look for Charles for the XML serializer
because I did give someone an answer yesterday where that was in. However I decided to do that this time not. I do not know of the complexebility of the object Charles wants to serialize (which is mostly simple) and deserialize
(which is mostly difficult) . And because Charles always start telling the
question simple and than comes an "however I am using it in that way", I did it this time not, but decided to wait for that last one.

:-)

Cor


Nov 20 '05 #26
Cor,
I was neither agreeing nor disagreeing with you! At the same time I was both
Agreeing & Disagreeing with you! ;-)

You made a statement, in the form of a question:
What is against the dataset it has everything you are asking
for build in in my opinion?
I was answering the question, The fact a dataset can only hold data rows is
something significant against it.

If you are a Data centric programmer then yes, using a DataSet is fine. So
in this regard I was agreeing with you.

However I find significantly more value in being an Object Oriented
programmer, so a lot of times a DataSet is too limiting. So in this regard I
was disagreeing with you.

Remember Object Oriented thinking involves organizing your app by
responsibility & behaviors, not simply I have a collection of data...

As I stated, using a Data centric approach is appropriate sometimes and
using an Object Oriented approach is appropriate .

Hope this helps
Jay

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl... Hi Jay B,

Did you see me giving an answer on Charles last question about the XML
serializer, that is because I agree this with you (I am sad you even do
think I am not).

:-)

However in this thread he was asking about a collection and in my simple
mind it was a collection of data.

So I pointed Charles on the dataset, because that is a very easy collection when it is all about data.

And I was in doubt if I would look for Charles for the XML serializer
because I did give someone an answer yesterday where that was in. However I decided to do that this time not. I do not know of the complexebility of the object Charles wants to serialize (which is mostly simple) and deserialize
(which is mostly difficult) . And because Charles always start telling the
question simple and than comes an "however I am using it in that way", I did it this time not, but decided to wait for that last one.

:-)

Cor


Nov 20 '05 #27
Hi Jay and Charles,

Thanks however, I did also thinking this over, two points do not forget the
extensibility of a dataset is limited by the very basic concepts of SQL.

(Jay you maybe know that I hate that "scripting" SQL language what you in my
opinion should do too because there is nothing less OOP than that in my
opinion) .

Another point I have thought on is that it is easy to put a serialized
string in a datarow. So my chalenge for the weekend is to fullfill the
question from Charles (I have seen samples so I hope it should go) and than
put them in a datarow, what is of course a piece of cake.

Hi Charles if this beneath is not what you mean, do than tell it to me?
--------------

XML serialization serializes only the public fields and property values of
an object into an XML stream. XML serialization does not include type
information. For example, if you have a Book object that exists in the
Library namespace, there is no guarantee that it will be deserialized into
an object of the same type.

---------------

I hope that I can do it with this and do not need the memstream because than
it is already ready.
\\\
Dim x As XmlSerializer = new XmlSerializer(GetType(MyClass))
Dim sw As New System.IO.StringWriter
x.Serialize(sw, MyObject)
ds.tables(0).rows(0)(0) = sw.tostring
///

I did not do this serialization of an object before so I am not sure I
succeed.

And Charles when it is with this hint ready for tomorrow European Time, do
not forget to tell it to me.

:-))

Cor
Nov 20 '05 #28
Hi Jay and Charles,

Thanks however, I did also thinking this over, two points do not forget the
extensibility of a dataset is limited by the very basic concepts of SQL.

(Jay you maybe know that I hate that "scripting" SQL language what you in my
opinion should do too because there is nothing less OOP than that in my
opinion) .

Another point I have thought on is that it is easy to put a serialized
string in a datarow. So my chalenge for the weekend is to fullfill the
question from Charles (I have seen samples so I hope it should go) and than
put them in a datarow, what is of course a piece of cake.

Hi Charles if this beneath is not what you mean, do than tell it to me?
--------------

XML serialization serializes only the public fields and property values of
an object into an XML stream. XML serialization does not include type
information. For example, if you have a Book object that exists in the
Library namespace, there is no guarantee that it will be deserialized into
an object of the same type.

---------------

I hope that I can do it with this and do not need the memstream because than
it is already ready.
\\\
Dim x As XmlSerializer = new XmlSerializer(GetType(MyClass))
Dim sw As New System.IO.StringWriter
x.Serialize(sw, MyObject)
ds.tables(0).rows(0)(0) = sw.tostring
///

I did not do this serialization of an object before so I am not sure I
succeed.

And Charles when it is with this hint ready for tomorrow European Time, do
not forget to tell it to me.

:-))

Cor
Nov 20 '05 #29
Hi Charles,

It was not that difficult.

It is a complete sample and I have placed also the dataset, and a combobox
to test.

The persons are from for us Benelux people from one of the famous Belgian
cartonists Vandersteen, that is because EricJ has often in his samples
Itemke, what is a kind of Dutch the Belgians always do and from which
Dutchman know it are Belgians.

I hope this helps you?

Cor

\\\
Private WithEvents combobox1 As New ComboBox
Private strt As Boolean
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim Belgen As New BelgenCollection
Belgen.Add(New Belg(New String() {"Lambiek", "Man", "Jenever"}))
Belgen.Add(New Belg(New String() {"Sidonia", "Vrouw", "Likeur"}))
Belgen.Add(New Belg(New String() {"Suske", "Jongen", "Cola"}))
Belgen.Add(New Belg(New String() {"Wiske", "Meisje", "Limonade"}))
Belgen.Add(New Belg(New String() {"Jerom", "Jongeman", "Bier"}))
Dim Serializer As New
Xml.Serialization.XmlSerializer(GetType(BelgenColl ection))
Dim sw As New System.IO.StringWriter
Serializer.Serialize(sw, Belgen)
Dim ds As New DataSet
Dim dt As New DataTable("Jay")
Dim dc As New DataColumn("Charles")
'This part only for Jay and Charles if he wants
dt.Columns.Add(dc)
ds.Tables.Add(dt)
dt.Rows.Add(dt.NewRow)
ds.Tables(0).Rows(0)(0) = sw.ToString
ds.WriteXml("c:\test1\charles.xml")
Dim dsJay As New DataSet
dsJay.ReadXml("c:\test1\Charles.xml")
Dim Charles As String = dsJay.Tables(0).Rows(0)(0).ToString
'End Jay part
Dim Deserializer As New Xml.Serialization.XmlSerializer _
(GetType(BelgenCollection))
Dim sr As New System.IO.StringReader(Charles)
Dim reader As New System.Xml.XmlTextReader(sr)
Dim Vlamingen As BelgenCollection
Vlamingen = CType(Deserializer.Deserialize(reader), _
BelgenCollection)
Me.Controls.Add(combobox1)
combobox1.DataSource = Vlamingen
strt = True
End Sub
Private Sub combobox1_SelectedIndexChanged(ByVal _
sender As Object, ByVal e As System.EventArgs) _
Handles combobox1.SelectedIndexChanged
If strt = True Then
MessageBox.Show(DirectCast(combobox1.SelectedValue , Belg).drank)
End If
End Sub
End Class
///
\\\
Public Class Belg
Public Naam As String
Public sex As String
Public drank As String
Public Sub New()
End Sub
Public Sub New(ByVal fill As String())
Naam = fill(0)
sex = fill(1)
drank = fill(2)
End Sub
Public Overrides Function tostring() As String
Return Naam
End Function
End Class
Public Class BelgenCollection
Inherits System.Collections.CollectionBase
Default Public Overloads ReadOnly _
Property Item(ByVal index As Integer) As Belg
Get
Return DirectCast(list.Item(index), Belg)
End Get
End Property
Public Sub Add(ByVal aBelg As Belg)
List.Add(aBelg)
End Sub
End Class
Nov 20 '05 #30
Hi Charles,

It was not that difficult.

It is a complete sample and I have placed also the dataset, and a combobox
to test.

The persons are from for us Benelux people from one of the famous Belgian
cartonists Vandersteen, that is because EricJ has often in his samples
Itemke, what is a kind of Dutch the Belgians always do and from which
Dutchman know it are Belgians.

I hope this helps you?

Cor

\\\
Private WithEvents combobox1 As New ComboBox
Private strt As Boolean
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim Belgen As New BelgenCollection
Belgen.Add(New Belg(New String() {"Lambiek", "Man", "Jenever"}))
Belgen.Add(New Belg(New String() {"Sidonia", "Vrouw", "Likeur"}))
Belgen.Add(New Belg(New String() {"Suske", "Jongen", "Cola"}))
Belgen.Add(New Belg(New String() {"Wiske", "Meisje", "Limonade"}))
Belgen.Add(New Belg(New String() {"Jerom", "Jongeman", "Bier"}))
Dim Serializer As New
Xml.Serialization.XmlSerializer(GetType(BelgenColl ection))
Dim sw As New System.IO.StringWriter
Serializer.Serialize(sw, Belgen)
Dim ds As New DataSet
Dim dt As New DataTable("Jay")
Dim dc As New DataColumn("Charles")
'This part only for Jay and Charles if he wants
dt.Columns.Add(dc)
ds.Tables.Add(dt)
dt.Rows.Add(dt.NewRow)
ds.Tables(0).Rows(0)(0) = sw.ToString
ds.WriteXml("c:\test1\charles.xml")
Dim dsJay As New DataSet
dsJay.ReadXml("c:\test1\Charles.xml")
Dim Charles As String = dsJay.Tables(0).Rows(0)(0).ToString
'End Jay part
Dim Deserializer As New Xml.Serialization.XmlSerializer _
(GetType(BelgenCollection))
Dim sr As New System.IO.StringReader(Charles)
Dim reader As New System.Xml.XmlTextReader(sr)
Dim Vlamingen As BelgenCollection
Vlamingen = CType(Deserializer.Deserialize(reader), _
BelgenCollection)
Me.Controls.Add(combobox1)
combobox1.DataSource = Vlamingen
strt = True
End Sub
Private Sub combobox1_SelectedIndexChanged(ByVal _
sender As Object, ByVal e As System.EventArgs) _
Handles combobox1.SelectedIndexChanged
If strt = True Then
MessageBox.Show(DirectCast(combobox1.SelectedValue , Belg).drank)
End If
End Sub
End Class
///
\\\
Public Class Belg
Public Naam As String
Public sex As String
Public drank As String
Public Sub New()
End Sub
Public Sub New(ByVal fill As String())
Naam = fill(0)
sex = fill(1)
drank = fill(2)
End Sub
Public Overrides Function tostring() As String
Return Naam
End Function
End Class
Public Class BelgenCollection
Inherits System.Collections.CollectionBase
Default Public Overloads ReadOnly _
Property Item(ByVal index As Integer) As Belg
Get
Return DirectCast(list.Item(index), Belg)
End Get
End Property
Public Sub Add(ByVal aBelg As Belg)
List.Add(aBelg)
End Sub
End Class
Nov 20 '05 #31
Hi Jay,

Succeeded completly I thought have a look at Charles

Cor
Nov 20 '05 #32
Hi Jay,

Succeeded completly I thought have a look at Charles

Cor
Nov 20 '05 #33
Hi Cor

That looks great. I will have to try it later as I am supposed to be going
to Longleat any moment now, and then we have guests until Monday. But
thanks, and I will get back to you.

Charles
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Oj**************@TK2MSFTNGP09.phx.gbl...
Hi Charles,

It was not that difficult.

It is a complete sample and I have placed also the dataset, and a combobox
to test.

The persons are from for us Benelux people from one of the famous Belgian
cartonists Vandersteen, that is because EricJ has often in his samples
Itemke, what is a kind of Dutch the Belgians always do and from which
Dutchman know it are Belgians.

I hope this helps you?

Cor

\\\
Private WithEvents combobox1 As New ComboBox
Private strt As Boolean
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim Belgen As New BelgenCollection
Belgen.Add(New Belg(New String() {"Lambiek", "Man", "Jenever"}))
Belgen.Add(New Belg(New String() {"Sidonia", "Vrouw", "Likeur"}))
Belgen.Add(New Belg(New String() {"Suske", "Jongen", "Cola"}))
Belgen.Add(New Belg(New String() {"Wiske", "Meisje", "Limonade"}))
Belgen.Add(New Belg(New String() {"Jerom", "Jongeman", "Bier"}))
Dim Serializer As New
Xml.Serialization.XmlSerializer(GetType(BelgenColl ection))
Dim sw As New System.IO.StringWriter
Serializer.Serialize(sw, Belgen)
Dim ds As New DataSet
Dim dt As New DataTable("Jay")
Dim dc As New DataColumn("Charles")
'This part only for Jay and Charles if he wants
dt.Columns.Add(dc)
ds.Tables.Add(dt)
dt.Rows.Add(dt.NewRow)
ds.Tables(0).Rows(0)(0) = sw.ToString
ds.WriteXml("c:\test1\charles.xml")
Dim dsJay As New DataSet
dsJay.ReadXml("c:\test1\Charles.xml")
Dim Charles As String = dsJay.Tables(0).Rows(0)(0).ToString
'End Jay part
Dim Deserializer As New Xml.Serialization.XmlSerializer _
(GetType(BelgenCollection))
Dim sr As New System.IO.StringReader(Charles)
Dim reader As New System.Xml.XmlTextReader(sr)
Dim Vlamingen As BelgenCollection
Vlamingen = CType(Deserializer.Deserialize(reader), _
BelgenCollection)
Me.Controls.Add(combobox1)
combobox1.DataSource = Vlamingen
strt = True
End Sub
Private Sub combobox1_SelectedIndexChanged(ByVal _
sender As Object, ByVal e As System.EventArgs) _
Handles combobox1.SelectedIndexChanged
If strt = True Then
MessageBox.Show(DirectCast(combobox1.SelectedValue , Belg).drank) End If
End Sub
End Class
///
\\\
Public Class Belg
Public Naam As String
Public sex As String
Public drank As String
Public Sub New()
End Sub
Public Sub New(ByVal fill As String())
Naam = fill(0)
sex = fill(1)
drank = fill(2)
End Sub
Public Overrides Function tostring() As String
Return Naam
End Function
End Class
Public Class BelgenCollection
Inherits System.Collections.CollectionBase
Default Public Overloads ReadOnly _
Property Item(ByVal index As Integer) As Belg
Get
Return DirectCast(list.Item(index), Belg)
End Get
End Property
Public Sub Add(ByVal aBelg As Belg)
List.Add(aBelg)
End Sub
End Class

Nov 20 '05 #34
Hi Cor

That looks great. I will have to try it later as I am supposed to be going
to Longleat any moment now, and then we have guests until Monday. But
thanks, and I will get back to you.

Charles
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Oj**************@TK2MSFTNGP09.phx.gbl...
Hi Charles,

It was not that difficult.

It is a complete sample and I have placed also the dataset, and a combobox
to test.

The persons are from for us Benelux people from one of the famous Belgian
cartonists Vandersteen, that is because EricJ has often in his samples
Itemke, what is a kind of Dutch the Belgians always do and from which
Dutchman know it are Belgians.

I hope this helps you?

Cor

\\\
Private WithEvents combobox1 As New ComboBox
Private strt As Boolean
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim Belgen As New BelgenCollection
Belgen.Add(New Belg(New String() {"Lambiek", "Man", "Jenever"}))
Belgen.Add(New Belg(New String() {"Sidonia", "Vrouw", "Likeur"}))
Belgen.Add(New Belg(New String() {"Suske", "Jongen", "Cola"}))
Belgen.Add(New Belg(New String() {"Wiske", "Meisje", "Limonade"}))
Belgen.Add(New Belg(New String() {"Jerom", "Jongeman", "Bier"}))
Dim Serializer As New
Xml.Serialization.XmlSerializer(GetType(BelgenColl ection))
Dim sw As New System.IO.StringWriter
Serializer.Serialize(sw, Belgen)
Dim ds As New DataSet
Dim dt As New DataTable("Jay")
Dim dc As New DataColumn("Charles")
'This part only for Jay and Charles if he wants
dt.Columns.Add(dc)
ds.Tables.Add(dt)
dt.Rows.Add(dt.NewRow)
ds.Tables(0).Rows(0)(0) = sw.ToString
ds.WriteXml("c:\test1\charles.xml")
Dim dsJay As New DataSet
dsJay.ReadXml("c:\test1\Charles.xml")
Dim Charles As String = dsJay.Tables(0).Rows(0)(0).ToString
'End Jay part
Dim Deserializer As New Xml.Serialization.XmlSerializer _
(GetType(BelgenCollection))
Dim sr As New System.IO.StringReader(Charles)
Dim reader As New System.Xml.XmlTextReader(sr)
Dim Vlamingen As BelgenCollection
Vlamingen = CType(Deserializer.Deserialize(reader), _
BelgenCollection)
Me.Controls.Add(combobox1)
combobox1.DataSource = Vlamingen
strt = True
End Sub
Private Sub combobox1_SelectedIndexChanged(ByVal _
sender As Object, ByVal e As System.EventArgs) _
Handles combobox1.SelectedIndexChanged
If strt = True Then
MessageBox.Show(DirectCast(combobox1.SelectedValue , Belg).drank) End If
End Sub
End Class
///
\\\
Public Class Belg
Public Naam As String
Public sex As String
Public drank As String
Public Sub New()
End Sub
Public Sub New(ByVal fill As String())
Naam = fill(0)
sex = fill(1)
drank = fill(2)
End Sub
Public Overrides Function tostring() As String
Return Naam
End Function
End Class
Public Class BelgenCollection
Inherits System.Collections.CollectionBase
Default Public Overloads ReadOnly _
Property Item(ByVal index As Integer) As Belg
Get
Return DirectCast(list.Item(index), Belg)
End Get
End Property
Public Sub Add(ByVal aBelg As Belg)
List.Add(aBelg)
End Sub
End Class

Nov 20 '05 #35

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

Similar topics

15
by: Phill. W | last post by:
Is anyone writing VB.Net (2003) code /without/ referencing the Microsoft.VisualBasic namespace(?), regardless of whether its Import'ed or not? The Powers That Be here are trying to introduce a...
27
by: Craig Buchanan | last post by:
Which vb.net object is the best match for the vb6 collection class? Specifically, I would like to be able to access the Item property with an index or a key string. I wrote my own class that...
9
by: Alexander Baranovsky | last post by:
Hello friends, How I can determine full path of Microsoft.Basic.dll? Thanks, Alexander
6
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have two questions with regards to the LEFT function. I ran into a problem with the LEFT function today. I knew it was a valid Function, but when I tried to use it, it was getting interpreted...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.