473,394 Members | 1,699 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.

how to call static method?

Tom
Hi,

I have an aspx file and it's cs file. I have another class
cs file which execute stored procedure.

In the class cs file, there are static methods.

But, the button event method in aspx.cs file is not static
type.

How can i use that static method in aspx.cs which is non-
static?
Nov 15 '05 #1
1 1822
You just call the method, using the class name in place of the instance
name:

public class MyClass
{
public static void StaticDoit() { }
public void Doit() { }
}

// instance:
MyClass mc = new MyClass();
mc.Doit();

// static:
MyClass.StaticDoIt();

Richard

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Tom" <ke*****@yahoo.com> wrote in message
news:01****************************@phx.gbl...
Hi,

I have an aspx file and it's cs file. I have another class
cs file which execute stored procedure.

In the class cs file, there are static methods.

But, the button event method in aspx.cs file is not static
type.

How can i use that static method in aspx.cs which is non-
static?

Nov 15 '05 #2

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

Similar topics

2
by: Ge Cong | last post by:
I have a class class MyClass { private: static double a; static void computeA(){ a =....; }
10
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will...
1
by: Guadala Harry | last post by:
Just wondering what it would take to call a static method in a static class of an ASP.NET 1.1 Web app from a different application. Specifically, I have a little "utility application" (C# Windows...
3
by: John E. | last post by:
I am trying to find a way to not have to reference an object in all my projects, since it is initialized & instantiated in my Common class. I have a 4 tier project (presentation, rules, dal,...
9
by: Joel Finkel | last post by:
Is there a way to execute a method if all we know is its name as a string? Let's say we have the following class. What is the code for the Execute method? I need a solution that works with the...
54
by: Zytan | last post by:
I have a log class that makes a synchronized TextWriter like so, in the constructor: StreamWriter sw = new StreamWriter(filename); tw = TextWriter.Synchronized(sw); In the destructor,...
9
by: Steve Richter | last post by:
in a generic class, can I code the class so that I can call a static method of the generic class T? In the ConvertFrom method of the generic TypeConvert class I want to write, I have a call to...
3
by: Pawel_Iks | last post by:
I have following class definition (A.h file): class A { public: int N; int count1(int n) {n++;} int count2(int n) {n+=5;} int otherFun(int n, int (*fun)(int)); }
4
by: Andrus | last post by:
I tried to use type parameter to call static method but got compile error 'T' is a 'type parameter', which is not valid in the given context. Why this is not allowed ? Should I really use a lot...
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
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
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,...
0
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.