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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:51:04+00:00 2026-06-16T02:51:04+00:00

This question probably has already been answered, I may be type the wrong question

  • 0

This question probably has already been answered, I may be type the wrong question in google, but I want to run the function time_refresh that is on form1 and works well from form2. this what I got so far:

Form1

public void time_refresh()
    {
        run_stop.Text = Properties.Settings.Default.s_update + " " + Properties.Settings.Default.s_update_int;
        run_stop.ForeColor = Color.Green;
    }

Form2

private Main_form_1 form1 = null;

and

form1.time_refresh();

But it get an error

Object reference not set to an instance of an object.
Kind of new to c# so any help would be excellent.

  • 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-16T02:51:05+00:00Added an answer on June 16, 2026 at 2:51 am

    The proper way to address this issue is through events. Form2 shouldn’t be accessing Form1 directly, it should simply be informing Form1 that it needs to update itself through an event.

    On Form2 create some event like:

    public Action event Refresh; //TODO rename as appropriate
    

    Then, on Form2 you can fire that event whenever you want Form1 to know that it needs to refresh itself:

    public void OnRefresh()  //call this method to fire the event
    {
        if(Refresh != null)
            Refresh();
    }
    

    Then on Form1 you can attach an event handler:

    Form2 other = new Form2();
    other.Refresh += () => time_refresh();
    other.Show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question has probably already been answered somewhere but I'm having a hard time
I know this question has probably been asked already but I would really like
this question has probably been asked before, but i'm stuck and i've tried a
I realize this question has probably been asked numerous times, but I have not
I feel like this question has probably been asked a thousand times already, so
Apologies if this question has already been answered, I've already done an extensive search
I suspect this has already been answered somewhere, but I can't find it, so...
Sorry if this has been answered already, but I could not find an appropriate
Probably someone has already asked this question but I'm not sure what I'm looking
I know this question has already been asked a lot, but I don't get

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.