473,657 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

custom collection using generics

Given the Class named KeyValue is the declaration for the Dictionary
version correct? I can't get the IDE to like it. This is VS2005 beta
2. I think i am doing something wrong but i don't see it.

Public Class KeyValue
Dim _keyID As FieldAttributes
Dim _value As FieldAttributes
'public accessors omitted
End Class
Public Class KeyValueDiction ary(Of KeyValue) : Inherits DictionaryBase
Public Sub Add(ByVal value As KeyValue)
Dictionary.Add( value.keyID.val ue, value) 'ide doesn't like this line.
End Sub 'Add
end Class

dan
Nov 21 '05 #1
1 1020
Hi,

Try this instead

Public Class KeyValueDiction ary: Inherits DictionaryBase
Public Sub Add(ByVal value As KeyValue)
Dictionary.Add( value.keyID.val ue, value) 'ide doesn't like this line.
End Sub 'Add
end Class

Ken
----------------
"Dan Holmes" <da*******@bigf oot.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
Given the Class named KeyValue is the declaration for the Dictionary
version correct? I can't get the IDE to like it. This is VS2005 beta 2.
I think i am doing something wrong but i don't see it.

Public Class KeyValue
Dim _keyID As FieldAttributes
Dim _value As FieldAttributes
'public accessors omitted
End Class
Public Class KeyValueDiction ary(Of KeyValue) : Inherits DictionaryBase
Public Sub Add(ByVal value As KeyValue)
Dictionary.Add( value.keyID.val ue, value) 'ide doesn't like this line.
End Sub 'Add
end Class

dan

Nov 21 '05 #2

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

Similar topics

6
4835
by: Michael D. Ober | last post by:
In VB 6, the loop iterator v in the following code must be a variant. dim v as variant dim c as new collection for each v in collection ... next v What is the general translation in VB 7.1 and VB 8 Beta 1? Also, is there an easy way to force "v" to be an early bound variable. In VB 6 this can be
3
1345
by: Michael Fällgreen | last post by:
Hi, I need to make a strongly typed collection of x, and the simplets way is to inherits list(of x). With that I can bind to a list-control. However - i don't need all the methods from list(of x). If I make a private list as list(of x) in a class and implements IList(of x) I can control what methods to be public. I works - but now I can't bind the collection to a listbox og grid (it says something about complex datatype).
3
1182
by: Jeff Louie | last post by:
Here is my try at generics. This creates a collection that implements IInvoke and IDisposable and Adds types that implement IInvoke and IDisposable. When the collection goes out of using scope dispose is called on all members of the collection. Calling Invoke on the collection calls Invoke on each member of the collection. http://www.geocities.com/jeff_louie/oop29.htm Regards, Jeff
19
4906
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the exception of custom Collection Classes. Background: I'm developing an A2K .mdb to be deployed as an .mde at my current job-site. It has several custom controls which utilize custom classes to wrap built-in controls, and add additional functionality....
3
1882
by: Nick | last post by:
I am developing a new management system for my company, and with it have 3 layers of functionality written in VB.NET 2.0. In the business logic layer I have a user class which contains all user information. I also would like to put in a userCollection class for all my users. There are many other classes like this on as well. However, what is the best way to do my collections? I would like them so that a userCollection can only contain...
6
5147
by: MikeSwann | last post by:
Dear All, I am trying to decide on to create a collection object for a project that I am working on. I am fairly new to OOP so this may be on the basic side. I have looked on the groups, but can't seem to find the answer I am looking for - just more questions! I want an object to hold Case details, one of the properties of this Case class will be RequestedBy. I ideally want this property to be a collection of User Objects (which...
4
5886
by: Stuart | last post by:
I hope someone can shed some light on an error I've been experiencing for sometime now, but can no longer continue to ignore :-( I've created a custom entity class which implements IEditableObject. I have then created a custom collection for this custom entity which naturally inherits CollectionBase and implements IBindingList. When I bind my custom collection to a DataGridView and started editing, it works correctly only up to the...
14
1696
by: cwineman | last post by:
Hello, I'm hoping to do something using Generics, but I'm not sure it's possible. Let's say I want to have a bunch of business objects and a data access class cooresponding to each business object. For each business object, I would have something like below: public class Apple { //apple stuff
6
2755
by: Erick | last post by:
I've created a class called Procs and a collection class called Processes which uses a hastable object to store the Procs. Now i want to enumerate with the "For each" to extract all the Procs in my Processes class. As far as i can tell i need to implement an IEnuerator method to do this. But how ? 'Procs Class Public Class Procs Private _Id As Integer
7
5503
by: Dale | last post by:
I have a design question. I am creating a custom collection of products. The unique key for the products is productId which is an integer. By default, IndexOf(object obj), when obj is an int, would return the value of obj because it returns the index of the item at position obj. Thoughts I had were to let the default method perform the default behavior and then create an overload as IndexOf(int index, ProductSearchCriteria criteria)...
0
8402
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8315
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8508
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8608
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6172
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.