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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:03:16+00:00 2026-05-30T04:03:16+00:00

I have a problem with my SerialDataReceivedEventHandler whitch fails to respond to data in

  • 0

I have a problem with my SerialDataReceivedEventHandler whitch fails to respond to data in serail port.

I have one main form in whitch i open port and do other stuf whitch need to be done for proper serial port communication (sending and receiving work)!
Then i open another form in same project whitch need same serial port for reading and writing!
Problem is that my SerialDataReceivedEventHandler in form2 not working jet it is completely identical to the first in mainform. (if i call serial.close() in main form app freezes or cause huge delay)

probably i have to make in my main from this event public, but i still don’t konow how to make my custom event or something else that will trigger the event in form 2 that data is arrived on port

I found this link for help but does not work with my app.

http://social.msdn.microsoft.com/Forums/en/netfxbcl/thread/7efccf0e-b412-4869-b942-a006773a833f

i’m using VS2008,framework3.5 (smart device project)

can somebody help me with that? , Please!

  • 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-30T04:03:17+00:00Added an answer on May 30, 2026 at 4:03 am

    Move your SerialPort consumption into a separate static (or a singleton) class. Create a DataReceived event in that class and fire it every time data is received. Have both forms subscribe to the DataReceived event – this way both forms will receive the data.

    Edit 1: Sample in pseudo code

    public static class Serial {
        public static delegate void DataReceivedEventHandler(object sender, ReceivedEventArgs e);
        public static event DataReceivedEventHandler DataReceived;
        static SerialPort serialPort = new SerialPort();        
    
        static Serial() {
            serialPort = new SerialPort();
            serialPort.DataReceived += Incoming;
            serialPort.Open();
        }
    
        private static void Incoming(object sender, SerialDataReceivedEventHandler args) {
            if (DataReceived != null) {
               ReceivedEventArgs rea = new ReceivedEventArgs {Data = args.Data};
               DataReceived(this, rea);
            }
        }
    }
    
    public class ReceivedEventArgs : EventArgs {
       public string Data { get; set;}
    }
    
    public class Form1: Form {
        public Form1() {
           Serial.DataReceived += Incoming;
        }
    
        private void Incoming(object sender, ReceivedEventArgs e) {
            // you receive the data here
            Debug.WriteLine(e.Data);
        }
    }
    
    public class Form2: Form {
        public Form2() {
           Serial.DataReceived += Incoming;
        }
    
        private void Incoming(object sender, ReceivedEventArgs e) {
            // you receive the data here
            Debug.WriteLine(e.Data);
        }
    }
    

    Again, this is pseudo code, without compiler nearby. Hope this helps.

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

Sidebar

Related Questions

I have problem with $_POST data. Some fields are missing from input form when
I have problem when I try insert some data to Informix TEXT column via
I have problem with the CSS. I'm changing dynamically one div's content. The problem
Have problem while getting data from Memcached on .NET MVC solution. I have this
I have problem witch change style border-left-color in next button, if main button is
I have problem with encoding data in Oracle database. I want to xor string
I have problem with one of my validation regex when using nonstandard utf-8 character.
I have problem positioning left sidebar (variating height DIV) ON IE6. Main needs: 1.
i have problem in javascript email validation, I wrote code something like, //emp.php <form
I have problem with pointers. This is working fine - int main(void){ char *w;

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.