Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6695727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:15:24+00:00 2026-05-26T06:15:24+00:00

Converting vb web project to c# using vwd express 2010. Development system is a

  • 0

Converting vb web project to c# using vwd express 2010.
Development system is a 64bit windows 7.

I have a commonly used function declared in an external cs file.
Contents of file “clsCommon.cs” =

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;

namespace Project_Website
{
    public class clsCommon
    {
        public void testA()
        {

        }

    } // clsCommon
} // namespace

In code behind I try to access the function testA() as follows:

testA();

Also tried:

clsCommon.testA();

and

Project_Website.clsCommon.testA();

The actual example I want to use is more complicated, but this is the simplest example that manifests the problem(s) I enumerate below:

  1. The As I type, Intellisense recognizes clsCommon, but doesn’t think testA() is a method in it. Intellisense only sees two methods: Equals() and ReferenceEquals().

  2. I ignore Intellisense and compile anyway, which produces the following error message:

Error 1 An object reference is required for the non-static field, method, or property ‘Project_Website.clsCommon.testA()’

What is the root cause of this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:15:25+00:00Added an answer on May 26, 2026 at 6:15 am

    You either need to make that method static, or create an instance of the class clsCommon to use it, i.e.:

    public class clsCommon
    {
        public static void testA()
        {
    
        }
    
    } // clsCommon
    

    Note that above method signature screams “side effects” since you don’t return anything and are not passing anything in. If you are modifying other members or properties of the class, you should create an instance instead and use a member method:

    var common = new clsCommon();
    common.testA();
    

    You should only make the method static if you do not need access to any other properties or methods with the clsCommon class. If that is the case for all of your methods, and clsCommon is just holding a bunch of utility methods, you should make the clsCommon class static as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's a sample ASP.NET project with this controller: using System; using System.Collections.Generic; using System.Web;
I am converting an older C# Website Project into a Web Application Project so
My project is converting a legacy fat-client desktop application into the web. The database
I have a web service I'm converting it to wcf I want to create
I've been converting some web site projects to web application projects. This involves using
We have a .Net 2.0 web app and are converting the solution and projects
I am converting a web site project to a web application project in VS
I have a web project which the folders are constructed within the areas .
I'm making a web based project management application using MySQL and PHP that uses
I have a solution that includes a Web Site (created using the web site

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.