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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:41:30+00:00 2026-06-14T14:41:30+00:00

I have a winforms applications which should be able to communicate with a custom

  • 0

I have a winforms applications which should be able to communicate with a custom device. I have a main window which has a button “Disconnect”. I have a user control which handles the logging, and a class (SerialCom) which handles all communciation.

When I load the user control I also setup the com port in the SerialCom class. This class receives data, and sends it to the user control via INotifyPropertyChanged, see this question for more detail here.

I want to acces the class SerialCom from the MainForm, without having to new the SerialCom class. but the SerialCom class is first created on the user control. (so, if I new the SerialCom class from the MainForm, the serial port will not be open, so I cannot close it.)

Any tips on how to acces class A from class B and C without having to new class A again? I was thinking about passing the event between the forms, is this the best option?

  • 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-14T14:41:31+00:00Added an answer on June 14, 2026 at 2:41 pm

    Turn your SerialCom class into a singleton. That way you have an instance that many classes can access. But please make sure to make this thread safe!

    See this for making thread safe singletons.

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

Sidebar

Related Questions

I have a WinForms application which should be able to save (to db) and
I have a C#/.NET Winforms application which has some settings stored using A '.settings'
I have a variety of small C# winforms applications (though this should apply equally
I have a WinForms UserControl which I am using in 2 different applications. A
I have to develop a application (Winforms-application) which is connected to a database within
I have a WinForms application that requires some configuration which I do at install
I have a winform application which contains a window resizable but one requirement is
We currently have a number of desktop applications (PowerBuilder, Winforms, WPF) that make use
Ok, I have developed this WinForms client, which interacts with a server (ASPX Application)
I have a requirement at hand which is to logon the user to his/her

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.