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

  • SEARCH
  • Home
  • 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 8380545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:29:07+00:00 2026-06-09T16:29:07+00:00

FIXED It was failing in 6 different spots in form1.designer.cs. It said I needed

  • 0

FIXED

It was failing in 6 different spots in “form1.designer.cs”. It said I needed to used it statically, so I changed all the errors from “this.xxxx” to “form1.xxxx” and it worked. Not sure I completely understand what I did though…

FIXED

Fairly new to programming here and just working on some basic OOP in C#. I am trying to call a method from another class in my Button Click event. The method passes one parameter which is user inputted text. I think the problem has something to do with the Method being static, but the parameter is dynamic, because it is user inputted. Please help me out!

public partial class Form1 : Form
{
    string _yourName = textBox1.Text;

    public Form1()
    {
        InitializeComponent();
    }

    private void Button1Click(object sender, EventArgs e)
    {
        if (DogCheckBox.Checked)
        {
            AnimalNoise.Bark(_yourName);
        }

        if (CatCheckBox.Checked)
        {
            AnimalNoise.Meow(_yourName);
        }

        if (FishCheckBox.Checked)
        {
            AnimalNoise.Girgle(_yourName);
        }
    }
}




public class AnimalNoise 
{
    public static void Bark(String name) 
    {
        MessageBox.Show(name + " Bark");
    }

    public static void Meow(String name)
    {
        MessageBox.Show(name + " Meow");
    }

    public static void Girgle(String name)
    {
        MessageBox.Show(name + " Girgle");
    }
}
  • 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-09T16:29:09+00:00Added an answer on June 9, 2026 at 4:29 pm

    First of all, you can’t access textBox1 before it’s actually created. You should capture the name inside the click callback. I think the error you’re seeing might be because somewhere in your code you have something else called AnimalNoise you’ll have to make sure there is nothing else called AnimalNoise and put AnimalNoise in it’s own file.

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

Sidebar

Related Questions

I have a fixed data which will be used in a UITableView later and
I've been trying to set issues to status fixed from my SVN commits, but
mvn clean package is failing due to a warning. Is it due to this
Hey all, i'm trying to center a table in a fixed position in a
I am outputting RTF from a word processor component. This is working well, but
EDIT: This was an old bug long since fixed in Scala 2.8 and later
FIXED! The problem was I didn't know you had to initialize a connection to
PROBLEM FIXED FOR NOW. I fixed it by deleting my javascript section for a
How do people switch fixed elements when scrolling down the page? Here's a perfect
I have a centred fixed width content div , and if there isnt enough

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.