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

Respected Sir! As i have not learnt java yet but most people say that
Given a document written with normal quotes, e.g. Ben said buttons, dear sir. I
I have always wondered why can't we use hyphens in between function names and
I have finally got in my mind what worried me about Dependency Injection and
Respected Sir! i should tell you that what i know and what i don't
Using MySQL, I have three tables: projects : ID name 1 birthday party 2
Here's a simplified version of a problem I'm working on: I have a bunch
In rails we can access db column through attributes rails provided, but can we
I am using Radio Layer Interface (RIL) Native APIs in Windows Mobile application .
How to format XML node to match the following format? How to add new

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.