Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

'Function A' is not a member of 'Class 1'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AlBruAn - 19 Oct 2007 21:41 GMT
I have a class named CheckVoucherRequest and within it, I have a function
declared thusly:
Public Overloads Shared Function RetrieveAllInfoForVoucherRequests(ByVal
areaID As Integer)

I'm trying to access info for the voucher requests by calling the function
as follows:
Dim gridSource As List(Of CheckVoucherRequest) =
CheckVoucherRequest.RetrieveAllInfoForVoucherRequests(areaID);
however, the compiler errors out by stating that:
'RetrieveAllInfoForVoucherRequests' is not a member of 'CheckVoucherRequest'.

If I select Class View from the menu, it very plainly shows the routine to
be a public member of CheckVoucherRequest.  What gives?  Why doesn't the
caller recognize it?
Jon Skeet [C# MVP] - 19 Oct 2007 21:52 GMT
> I have a class named CheckVoucherRequest and within it, I have a function
> declared thusly:
[quoted text clipped - 11 lines]
> be a public member of CheckVoucherRequest.  What gives?  Why doesn't the
> caller recognize it?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

(And I'm fine with it being a VB.NET example, of course :)

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

AlBruAn - 19 Oct 2007 22:20 GMT
> Could you post a short but complete program which demonstrates the
> problem?
[quoted text clipped - 3 lines]
>
> (And I'm fine with it being a VB.NET example, of course :)
Super!  Saves me the time of converting it to C# and hunting down all the
missing ; and wondering why ( ) won't work for holding an indexer's value. :)

Company's internet policy won't allow me access to your site :(  
Anyway, abbreviated code-behind for my web form is as follows:
Imports Bcbst.IM.FRO.BusinessObjects
Imports Bcbst.IM.FRO.BusinessObjects.UserControl
Imports Bcbst.IM.Common.DataAccessLayer
Imports Bcbst.IM.FRO.Common
Imports Microsoft.Win32
Imports System.Diagnostics
Imports System.Collections
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Net

Partial Class CheckVouchers_CheckVoucherApprovals
    Inherits System.Web.UI.Page

    Private currentUser As BcbstUser = Nothing
    Private areaID As Integer = Null.NullInteger

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then
            ' Validate user's permissions
            currentUser =
BcbstUser.RetrieveUserByBcbstId(My.User.Name.ToLower.Replace("bcbst\",
String.Empty))

            areaID = currentUser.AreaId

            Dim keyNames As String() = {"ReceiptId"}

            Dim gridSource As List(Of CheckVoucherRequest) = _
            CheckVoucherRequest.RetrieveAllInfoForVoucherRequests(areaID)
            gridVoucherRequests.DataSource = gridSource
            gridVoucherRequests.DataKeyNames = keyNames
            gridVoucherRequests.DataBind()

        End If
    End Sub
End Class

Here's an abbreviated copy of my business object class:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Collections
Imports System.Collections.Generic
Imports System.Web.UI

Imports Bcbst.IM.Common.DataAccessLayer
Imports Bcbst.IM.FRO.Common

Namespace Bcbst.IM.FRO.BusinessObjects

    <Serializable()> _
    Public Class CheckVoucherRequest

#Region " Members "
        Private _ReceiptID As Integer = -1
        Private _EntityPaidID As String = String.Empty
        Private _EntityTypeID As Integer = -1
        Private _EntityTypeName As String = String.Empty
        Private _ClaimNumber As Integer = -1
        Private _AmountRequested As Decimal = Null.NullDecimal
        Private _VoucherReasonCode As String = String.Empty
        Private _VoucherReason As String = String.Empty
        Private _EntityType As String = String.Empty
        Private _AreaID As Integer = -1
        Private _WriteErrors As List(Of CheckVoucherError) = New List(Of
CheckVoucherError)

        Private Shared _ConnString As String = _
            ConfigurationManager.ConnectionStrings("FROMain").ConnectionString
#End Region

        Public Shared Function RetrieveAllInfoForVoucherRequests(ByVal areaID As
Integer) 'As List(Of CheckVoucherRequest)
            Dim requestList As New List(Of CheckVoucherRequest)

            Dim dr As SqlDataReader = SqlDataAccess.ExecuteReader(_ConnString, _
            "CheckVoucher.RetrieveInfoForAllRequests", areaID)

            While dr.Read()
                Dim info As New CheckVoucherRequest(dr("ReceiptID"), _
                dr("EntityTypeID"), dr("EntityID"), _
                Null.SetNull(dr("ApprovalUserID"), Null.NullString), _
                Null.SetNull(dr("ApprovalDate"), Null.NullDate), _
                CheckVoucherReason.RetrieveByCode(dr("CheckVoucherReasonCode"),
areaID).ToString(), _
                Null.SetNull(dr("ApprovalDeniedReason"), Null.NullString), _
                dr("RequestedAmount"))

                requestList.Add(info)
            End While
            Return requestList
        End Function
    End Class
Jon Skeet [C# MVP] - 19 Oct 2007 22:37 GMT
> > Could you post a short but complete program which demonstrates the
> > problem?
[quoted text clipped - 3 lines]
> >
> > (And I'm fine with it being a VB.NET example, of course :)

> Super!  Saves me the time of converting it to C# and hunting down all the
> missing ; and wondering why ( ) won't work for holding an indexer's value. :)

:)

> Company's internet policy won't allow me access to your site :(  

Rats.

What I'd really like to see is a version of the code which we can
compile and run ourselves. In other words, it shouldn't be code behind
for a web project (too much hassle to set up) - a simple console
project is easiest. It also shouldn't need to use any classes beyond
the ones shown in the code - after all, we don't need to *do* anything
with the code.

I'd start off by taking your existing business objects library (I'm
assuming it's in its own assembly?) and trying to call the method in
question from a console app. That should give you some more information
about where the problem lies.

One *possible* cause: I don't suppose you've got a property or other
member of your code-behind called CheckVoucherRequest, have you?

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.