473,574 Members | 10,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft.Visua lBasic.Collecti on 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 5672
Hi,

Take a look at the hashtable.

Ken
---------------
"Craig Buchanan" <so*****@micros oft.com> wrote in message
news:e9******** *****@TK2MSFTNG P12.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*****@micros oft.com> wrote in message
news:e9******** *****@TK2MSFTNG P12.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*****@micros oft.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.Visua lBasic.Collecti on 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*****@micros oft.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.Visua lBasic.Collecti on 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.Visua lBasic
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*******@free net.de> wrote in message
news:40******** *************** @news.freenet.d e...
"Craig Buchanan" <so*****@micros oft.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.Visua lBasic.Collecti on 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.Visua lBasic
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*******@free net.de> wrote in message
news:40******** *************** @news.freenet.d e...
"Craig Buchanan" <so*****@micros oft.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.Visua lBasic.Collecti on 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.Visua lBasic.Collecti on.

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.Collecti ons.Specialized .NameObjectColl ectionBase and add two Item
properties.

There are a couple of other collections (NameValueColle ction for example) in
System.Collecti ons.Specialized that may be useful also.

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

Hope this helps
Jay

"Craig Buchanan" <so*****@micros oft.com> wrote in message
news:e9******** *****@TK2MSFTNG P12.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.Visua lBasic.Collecti on.

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.Collecti ons.Specialized .NameObjectColl ectionBase and add two Item
properties.

There are a couple of other collections (NameValueColle ction for example) in
System.Collecti ons.Specialized that may be useful also.

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

Hope this helps
Jay

"Craig Buchanan" <so*****@micros oft.com> wrote in message
news:e9******** *****@TK2MSFTNG P12.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.Visua l basic
namespace is not for compatible reasons. However, I did wish they had placed
the Microsoft.Visua lbasic 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

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

Similar topics

15
4003
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 "standard" that we should be writing our "VB" programs /without/ using this namespace at all and relying instead solely on CLR functionality. ...
27
413
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 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...
9
6813
by: Alexander Baranovsky | last post by:
Hello friends, How I can determine full path of Microsoft.Basic.dll? Thanks, Alexander
6
6744
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 as the LEFT location of a control or something like that, instead of the LEFT function. (I want to extract the left portion of a string). Anyway, I...
0
7821
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7739
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7835
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3761
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3777
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1360
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1087
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.