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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:48:02+00:00 2026-05-29T03:48:02+00:00

I am trying to rename a button from a string. Sounds simple enough? Well

  • 0

I am trying to rename a button from a string. Sounds simple enough? Well I have scowered the internet and tried many things however I keep coming up with the same errors.

I have 2 forms and one class file. I am using object orientation to pass a string from a textbox to form1 where upon the “button1.Text” can be change passing it through my “Reference class” (I don’t think it can be done any other way)

    private void button1_Click_1(object sender, EventArgs e)
    {
        Refclass Ref = new Refclass();
        String but1 = Ref.but1;

        String btn = "button1"; this.Controls[btn].Text = but1;
    }

I am sure this is probably wrong but I hope by this might be able to understand what I am trying to do. I am calling a string from the “Ref” class and calling the string “hell”

Needless to say I am either getting a debugging error and totally crashing visual studio or I get an error saying “Object reference not set to an instance of an object.”

I know I am going wrong somewhere does anyone know where? Thank you.

  • 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-29T03:48:03+00:00Added an answer on May 29, 2026 at 3:48 am

    there is no need of create the object for class.if your class in same assembly.just call like this.

    button1.text=ref.but1;
    

    where but1 is a const string in that class.

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

Sidebar

Related Questions

I have a lot of files I'm trying to rename, I tried to make
I'm trying to rename some files in a directory using Python. Say I have
I am trying to rename the column datatype from text to ntext but getting
So I was trying to rename a column in my table from Conversion_Fee_PerShare to
I have a custom list definition, and I am trying to rename the custom
I have a 12 GB table full of pictures, I'm trying to rename the
Trying to rename a function's name via the refactor->rename button in a categoriy's .h
I am trying to rename all the files present in a Windows directory using
I'm trying to rename the columns. The syntax should be the column name between
I'm trying to rename some files, but getting a baffling error*. When I run

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.