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 7809411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:25:47+00:00 2026-06-02T03:25:47+00:00

I have a program in which the user enters a username and a date

  • 0

I have a program in which the user enters a username and a date and then clicks a button which inputs the data into a database.

The problem I am having is that I cannot seem to pass the text box date data as an argument in a method to my BOL class. I get the following error: “Member ‘P90XPRogramt.ProgramLoginBOL.TestParsing(string)’ cannot be accessed with an instance reference; qualify it with a type name instead”

Here is the code from my UI layer:

public partial class ProgramLoginForm : Form
{
    private ProgramLoginBOL busObject =
        new ProgramLoginBOL();       

    //default constructor
    public ProgramLoginForm(string dayNo)
    {
        InitializeComponent();
        busObject.InitializeConnection();
    } 

    private void btnBeginProgram_Click(object sender, EventArgs e)
    {
        busObject.UserName = txtEnterName.Text;            

        busObject.TestParsing(txtStartDate.Text);            

    }

    //event handler to close program
    private void btnExitProgram_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }        
}

Here is the code for my BOL class:

class ProgramLoginBOL
{
    //declare variables
    string userName = "";

    //instantiate a connecttion object to Access database
    OleDbConnection aConnection =
        new OleDbConnection(
            "Provider=Microsoft.ACE.OLEDB.12.0;" +
            "Data Source=P90XDatabase.accdb;");

    public ProgramLoginBOL()
    {
    }

    //property for userName variable
    public string UserName
    {
        get { return userName; }
        set { userName = value; }
    }

    public static DateTime TestParsing(string datetext)
    {
        DateTime dt;

        if (DateTime.TryParseExact(datetext, "d", null, 0, out dt))
        {
            Console.WriteLine("Parsed to {0}", dt);
        }
        else
        {
            Console.WriteLine("Bad date");
        }
        return dt;
    }

    public void InitializeConnection()
    {
        ProgramLoginDAL.InitializeConnection(aConnection);
    }
}

I’m not sure what it is telling me to do. By type name I assume they mean data type, so I tried the following:

string busObject.TestParsing(txtStartDate.Text);

string.busObject.TestParsing(txtStartDate.Text);

string.TestParsing(txtStartDate.Text);

busObject.TestParsing(string txtStartDate.Text);

None of these have worked. I also tried using DateTime instead of string. As I said, I’m at a loss as to what it wants me to do.

  • 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-06-02T03:25:49+00:00Added an answer on June 2, 2026 at 3:25 am

    Static methods can’t be called with instances of a class exactly as error message says.

    P90XPRogramt.ProgramLoginBOL.TestParsing(txtStartDate.Text);
    

    For future errors try searching for error code first – normally MSDN article contains explanation and sample, like in this case CS0176

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

Sidebar

Related Questions

I have a program in which the user inputs information into two separate text
I have this following program which gets the number of files from user, then
I have a program which makes some calculations according to user data. The program
I have a program in which a user selects a row in a Datagrid
I have a program which has a text box that the user can edit.
I have a project to create a program, which prevents the user from escaping
I have created a C program which updates user name with client input, but
I have a list of string. When user inputs chars in, the program would
I have to create a program which requests the user to input file names
I have this program which takes a array of words and asks user to

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.