CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: NewsGroup Date Entered: 8/9/2006 2:04:26 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 76 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
mcostello
Asp.Net User
Comparing Enum values in a collection - BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.8/9/2006 2:04:26 PM

0/0

I am upgrading from asp1.1 to 2.0

I use collection classes to sort data (e.g in datagrids etc)

Public

Enum newsFields
      title
End Enum

Public Overloads Sub Sort(ByVal sortField As newsFields, ByVal isAscending As Boolean)
   
Select Case sortField
         
Case newsFields.title
                     
MyBase.Sort(New TitleComparer)
   End Select

   If Not isAscending Then
      
MyBase.Reverse()
   
End If

End Sub 'Sort

Private NotInheritable Class TitleComparer
      
Implements IComparer

Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare
         
Dim first As newsFields = CType(x, newsFields)
         
Dim second As newsFields = CType(y, newsFields)
*********This line throws the warning***********
                  
Return first.title.CompareTo(second.title)

      End Function 'Compare
End Class TitleComparer

******************************************
I get a warning - BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.

How can I get around this?
Any and all help appreciated

Mark


samsp
Asp.Net User
Re: Comparing Enum values in a collection - BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.8/9/2006 5:51:26 PM

0/0

Huh. An enum is a list of possible values, not a structure.

First and second are both essentially integers, which may have a possible value of title.

I think you are using an Enum where you should be using a class or structure.

2 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Comparing Enum values in a collection - BC42025: Access of shared ... I use collection classes to sort data (e.g in datagrids etc). Public. Enum newsFields title. End Enum ... I get a warning - BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. How can I get around this? ...
Visual Studio Magazine Online | On VB: Beautify Your Code With ... Compare this syntax to what you had to do previously: ... warning BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. ... For value types, this makes a lot of sense. Consider an increment method added to integer: ...




Search This Site:










custom tool and embedded resource

web deployment projects not able to change local debug web.config?

the verbose option for compilation

debugging javascript within .aspx pages

move files to web server

"control cannot be added because visual studio cannot find the control's type in the control assembly".

vs purchasing options

refreshing the tableadapters in the dataset gui

2005 and 2003

unit testing of a web service and code coverage

what does 'wrap' means in vs2005?

using sql server 2000 with vs 2005 standard and pro

web deployment using 'web setup project'

turning off missing image errors?

sql server 2005 + express

assembly 'mysql.data, version=1.0.4.20163, culture=neutral could not be loaded.

help-images do not show in vs 2005 but do when published

change default namespaces for new c# class

a unhandled win32 exception occurred in iexplore.exe[2584]

how to avoid the debugging error?

amazonmoviecollection_1_0_vb_rtm.vsi is not a valid windows image

memory allocation when creating an object of exception class

stressing .net application

data providers in whidbey

unable to create new tables or editi exsiting ones

c# property formatting

project hangs. need to stop the web page, and invoke it again for the page to run.

sample project with business layer and data layer

extending the "add asp.net folder" options

vs 2005 and classic asp

  Privacy | Contact Us
All Times Are GMT