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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:41:20+00:00 2026-06-05T13:41:20+00:00

Please, what is wrong with this: private void Form2_Load(object sender, EventArgs e) { switch

  • 0

Please, what is wrong with this:

private void Form2_Load(object sender, EventArgs e)
{
    switch (Form2.Tag) //error
    {
        case "desc":
            MessageBox.Show("desc");
        break;

        case "sms":
            MessageBox.Show("sms");
        break;
    }
}

Error:

An object reference is required for the non-static field, method, or property System.Windows.Forms.Control.Tag.get
  • 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-05T13:41:22+00:00Added an answer on June 5, 2026 at 1:41 pm

    You probably meant to say this.Tag. Referencing the Tag property will require an instance of Form2, hence the error message you received.

    Edit:

    Forgot Tag was an object. Cast it to a string and your statement should work:

    switch ((string)this.Tag)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please, what is wrong with this code: InitializeComponent(); this.KeyDown += new KeyEventHandler(dgvC_KeyDown); private void
whats wrong with this? anybody help me please.. if(stripos($nerde, $hf) !== false) && (stripos($nerde,
Can anyone please explain to me whats wrong with this piece of code and
Can someone please tell me whats wrong with this code. I'm not getting complete
Can anyone please point out what im doing wrong with this Stored Procedure please.
Please, help me. I dont know what is wrong with this code: import android.appwidget.AppWidgetProvider;
Please feel free to move this to meta/superuser if this is the wrong place.
Please let me know if I'm coming at this block on a wrong angle.
I am new and Please be patient If I am wrong. This below code
Could someone point me whats wrong with this code please? I'm having a very

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.