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

BaseGet Method of NameObjectCollectionBase

I am getting an error saying:
Public Method BaseGet not found on
Type 'clsRunCollection'.

The error occurs on the call to Public Property Run. If I
change the parameter to an integer it works but I need to
retrieve the object based on it's key.
The following is my class:
Imports System.Collections.Specialized
Public Class clsRunCollection : Inherits
NameObjectCollectionBase

'Public Sub New()
' MyBase.New()
'End Sub

Public Sub Add(ByVal strKey As String, ByVal objRun
As clsRun)
MyBase.BaseAdd(strKey, objRun)
End Sub

Public ReadOnly Property RunExists(ByVal strKey As
String) As Boolean
Get
If MyBase.BaseGet(strKey) Is Nothing Then
Return False
Else
Return True
End If
End Get
End Property

Public Sub Remove(ByVal idx As Object)
If TypeName(idx) = "String" Then
MyBase.BaseRemove(idx)
Else
MyBase.BaseRemoveAt(idx)
End If
End Sub

Public ReadOnly Property Run(ByVal idx As Object) As
clsRun
Get
If TypeName(idx) = "String" Then
Return MyBase.BaseGet(CStr(idx))
Else
Return MyBase.BaseGet(idx)
End If

End Get
'Set(ByVal Value As clsRun)
' MyBase.BaseSet(vbNull, Value)
'End Set
End Property

'Count is inherited so no need to implement
End Class
Thanks,

Billy Jacobs

Jul 21 '05 #1
2 1773
Never mind I figured it out. I needed to convert the
object paramter to an int if it was not a string.

Billy Jacobs
-----Original Message-----
I am getting an error saying:
Public Method BaseGet not found on
Type 'clsRunCollection'.

The error occurs on the call to Public Property Run. If Ichange the parameter to an integer it works but I need toretrieve the object based on it's key.
The following is my class:
Imports System.Collections.Specialized
Public Class clsRunCollection : Inherits
NameObjectCollectionBase

'Public Sub New()
' MyBase.New()
'End Sub

Public Sub Add(ByVal strKey As String, ByVal objRun
As clsRun)
MyBase.BaseAdd(strKey, objRun)
End Sub

Public ReadOnly Property RunExists(ByVal strKey As
String) As Boolean
Get
If MyBase.BaseGet(strKey) Is Nothing Then
Return False
Else
Return True
End If
End Get
End Property

Public Sub Remove(ByVal idx As Object)
If TypeName(idx) = "String" Then
MyBase.BaseRemove(idx)
Else
MyBase.BaseRemoveAt(idx)
End If
End Sub

Public ReadOnly Property Run(ByVal idx As Object) As
clsRun
Get
If TypeName(idx) = "String" Then
Return MyBase.BaseGet(CStr(idx))
Else
Return MyBase.BaseGet(idx)
End If

End Get
'Set(ByVal Value As clsRun)
' MyBase.BaseSet(vbNull, Value)
'End Set
End Property

'Count is inherited so no need to implement
End Class
Thanks,

Billy Jacobs

.

Jul 21 '05 #2
Billy,
Glad you got it working.

FYI:
A 'better' way of doing this:
If TypeName(idx) = "String" Then
Is to use the TypeOf expression

If Typeof idx Is String Then

I say 'better' in that Typeof will return true for types derived from the
type given.

If Typeof obj Is Form Then

Will return true for all forms.

Also intellisense knows about TypeOf, you will be presented with a list of
types to check, rather then needing to type a string constant.

Hope this helps
Jay
"Billy Jacobs" <bi********@csa.com> wrote in message
news:0b****************************@phx.gbl... I am getting an error saying:
Public Method BaseGet not found on
Type 'clsRunCollection'.

The error occurs on the call to Public Property Run. If I
change the parameter to an integer it works but I need to
retrieve the object based on it's key.
The following is my class:
Imports System.Collections.Specialized
Public Class clsRunCollection : Inherits
NameObjectCollectionBase

'Public Sub New()
' MyBase.New()
'End Sub

Public Sub Add(ByVal strKey As String, ByVal objRun
As clsRun)
MyBase.BaseAdd(strKey, objRun)
End Sub

Public ReadOnly Property RunExists(ByVal strKey As
String) As Boolean
Get
If MyBase.BaseGet(strKey) Is Nothing Then
Return False
Else
Return True
End If
End Get
End Property

Public Sub Remove(ByVal idx As Object)
If TypeName(idx) = "String" Then
MyBase.BaseRemove(idx)
Else
MyBase.BaseRemoveAt(idx)
End If
End Sub

Public ReadOnly Property Run(ByVal idx As Object) As
clsRun
Get
If TypeName(idx) = "String" Then
Return MyBase.BaseGet(CStr(idx))
Else
Return MyBase.BaseGet(idx)
End If

End Get
'Set(ByVal Value As clsRun)
' MyBase.BaseSet(vbNull, Value)
'End Set
End Property

'Count is inherited so no need to implement
End Class
Thanks,

Billy Jacobs

Jul 21 '05 #3

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

Similar topics

7
by: Edward Diener | last post by:
This simple code example gives me the message, "TypeError: 'staticmethod' object is not callable". class X(object): def Y(x): print x Y = staticmethod(Y) ad = { 1 : Y } def Z(self):...
3
by: Ed | last post by:
Greetings! I'm trying to implement own collection BaseCollection (inherited from NameObjectCollectionBase class), but my attempt to override NameObjectCollectionBase virtual method public virtual...
1
by: Rein Petersen | last post by:
Hi Everyone! I hope someone may have experience serializing a NameObjectCollectionBase (System.Collections.Specialized) and can advise me as to why I receive this error (below) when I try to...
2
by: Mark Overstreet | last post by:
I am writing custom collections for my business objects but I need support for the foreach construct. I also need key support so I am inheriting from NameObjectCollectionBase. I need to support...
1
by: V. | last post by:
Hi, I need to sort the object System.Collections.Specialized.NameObjectCollectionBase based on one property of the special object. Is there an easy way to do this? Thanks Vicky
3
by: Sam Marrocco | last post by:
I've created a collection class that inherits the NameObjectCollectionBase. I'd like to add a few functions, such as being able to insert a new item at an indexed or keyed location in the...
2
by: Sam Marrocco | last post by:
I've created a collection class that inherits NameObjectCollectionBase (call it MyCollection). MyCollection is declared as serializable, and serializes fine. A cursory glance into the serialized...
2
by: Craig Buchanan | last post by:
I have a class that inherits NameObjectCollectionBase called Products. In the class' constructor, I add items using BaseAdd(key,value), where key is a string representation of an id and value an...
2
by: Billy Jacobs | last post by:
I am getting an error saying: Public Method BaseGet not found on Type 'clsRunCollection'. The error occurs on the call to Public Property Run. If I change the parameter to an integer it works...
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...
1
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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.