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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:45:48+00:00 2026-05-20T09:45:48+00:00

Sir, I have two window forms, each form has some controls. I want to

  • 0

Sir, I have two window forms, each form has some controls. I want to access control of one form from another form. I have tried two ways-
1- Make controls public and access them.
2- Make public properties getting and setting control according to requirement.
But in both the case i have to create the object of first form in order to access the properties or public control. I have instaintiated a socket object and bind it to the local endpoint in the constructor of the first form. Now if I create another object of first form in order to access the control, constructor is fired again and the same code of socket binding in executed which results an exception. Please suggest me what to do ???
Thankssssss….

  • 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-20T09:45:48+00:00Added an answer on May 20, 2026 at 9:45 am

    You can do this in many ways…

    You can declare some static getter/setter to manage a static instance of the compononent:

    private static Type _myObject;
    public static Type MyObject
    {
       get
       {
          return _myObject;
       }
    }
    

    In this case you can access it from evrywere if you only need a specific shared object

    MyClass.MyObject.Function();
    

    Or you can define a getter for the whole class:

    public class MyClass
    {
       static MyClass _myClass;
       public static MyClass Instance { get { return _myClass; } }
    
       public MyClass()
       {
          _myClass = this;
          ...
       }
    
       public void Hello()
       {
          Console.WriteLine("CIAO!")
       }
    } 
    

    And getting all the methods and properties of the class:

    MyClass.Instance.Hello();
    

    You can pass also the class in a constructor, property or function, but i dislike this way…

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

Sidebar

Related Questions

Sir, i am working in a java application.On that application i have to access
Sir, I am having some problem regarding database in SQL Server. My project is
Hello Sir i want send list of data to php server i use following
Hello sir i send the arraylist through url pass from android to php all
Sir/Madam, I want to know where WSDL exists. Do user need to do interact
I have some HTML code that goes a little something like this. <p style=text-align:left;>Hello,
I have ran into a peculiar problem with NSXMLParser. For some reason it cuts
I have written a simple WCF web service in C# which returns records from
Edited........ sorry Sir I was referring this piece of code from Stephen Toub's article..
sir i have got an error while running my project in ecclipse. The error

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.