473,394 Members | 1,702 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,394 software developers and data experts.

strange compile error!

Hey

asp.net 2.0

This line of code:

MembershipUserCollection onlineUsers = Membership.GetAllUsers;

In this script:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MasterPages_ContentMaster : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
MembershipUserCollection onlineUsers = Membership.GetAllUsers;
}
}
}

Gives this compile error:
Error 2 Cannot convert method group 'GetAllUsers' to non-delegate type
'System.Web.Security.MembershipUserCollection'. Did you intend to invoke the
method? C:\Documents and Settings\Jeff\My Documents\Visual Studio
2005\WebSites\Helloworld\MasterPages\ContentMaster .master.cs 20 52
C:\...\Helloworld\

The code is placed in a master page...

I don't understand what I'm doing wrong here...

Any suggestions?
Oct 10 '06 #1
3 1427
Its a method, you need some parenthesis there.
http://msdn2.microsoft.com/en-us/library/dy8swhya.aspx
Jeff wrote:
Hey

asp.net 2.0

This line of code:

MembershipUserCollection onlineUsers = Membership.GetAllUsers;

In this script:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MasterPages_ContentMaster : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
MembershipUserCollection onlineUsers = Membership.GetAllUsers;
}
}
}

Gives this compile error:
Error 2 Cannot convert method group 'GetAllUsers' to non-delegate type
'System.Web.Security.MembershipUserCollection'. Did you intend to invoke the
method? C:\Documents and Settings\Jeff\My Documents\Visual Studio
2005\WebSites\Helloworld\MasterPages\ContentMaster .master.cs 20 52
C:\...\Helloworld\

The code is placed in a master page...

I don't understand what I'm doing wrong here...

Any suggestions?
Oct 10 '06 #2
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eK**************@TK2MSFTNGP05.phx.gbl...
This line of code:
MembershipUserCollection onlineUsers = Membership.GetAllUsers;
Gives this compile error:
Error 2 Cannot convert method group 'GetAllUsers' to non-delegate type
[...]

You're going to laugh (or cry):
MembershipUserCollection onlineUsers = Membership.GetAllUsers();

Having that "()" there is what you need. This drove me nuts for a while, as
VB.Net doesn't need it and I got in the habit of omitting it.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins
Oct 10 '06 #3
solved, GetAllUsers is a method, not a property....
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eK**************@TK2MSFTNGP05.phx.gbl...
Hey

asp.net 2.0

This line of code:

MembershipUserCollection onlineUsers = Membership.GetAllUsers;

In this script:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MasterPages_ContentMaster : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
MembershipUserCollection onlineUsers = Membership.GetAllUsers;
}
}
}

Gives this compile error:
Error 2 Cannot convert method group 'GetAllUsers' to non-delegate type
'System.Web.Security.MembershipUserCollection'. Did you intend to invoke
the method? C:\Documents and Settings\Jeff\My Documents\Visual Studio
2005\WebSites\Helloworld\MasterPages\ContentMaster .master.cs 20 52
C:\...\Helloworld\

The code is placed in a master page...

I don't understand what I'm doing wrong here...

Any suggestions?

Oct 10 '06 #4

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

Similar topics

0
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
2
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
3
by: Don McNamara | last post by:
Hi, I've hit quite a strange problem with XmlSerializer on my W2K3 server. When I serialize/deserialize using an exe on my local computer (XP), everything works fine. When I put the code out on...
6
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence...
0
by: Kris Vanherck | last post by:
yesterday i started getting this strange error when i try to run my asp.net project: Compiler Error Message: CS0006: Metadata file 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net...
6
by: Chad | last post by:
I'm not too sure if the question would fall under comp.lang.c or some kind of compiler newsgroup. I'm going to ask anyhow. Given the following: #include <stdio.h> int main(void) { int a =...
4
by: tony | last post by:
Hello! My question is about calling this method CollectData below but I get a compile error that I shouldn't have because the type parameter is correct. The compile error is the following:...
6
by: tony | last post by:
Hello! I have several projects where each one build a library.(class library or window control library). Now I get some strange compile error when building the *.exe file and doesn't...
9
by: Larry | last post by:
I was testing the buffer size of system call, read(), and found a strange error on Ubuntu 7.10 server. The code is attached. If the BUFFSIZE is set to from 128 to 255, the code will produce an...
1
by: pitjpz | last post by:
We have moved our Database to another server. The server it was on used SQL 4 and the new one its on now uses SQL5 the only problem we can find is that when you attempt to delete a record from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.