none
SerialPort DataReceived Event Read Byte ? RRS feed

  • Question

  • Hello,
    I would like to ask you to share information on a subject,
    I am experiencing a problem related to data transmission and data retrieval on an Indicator device connected to a serial port on a project I am developing.
    Code I Write For Trial Purpose As Below,

    SerialPortTLB_DataReceived Event Overflow Should Not Send on Textbox as Byte,
    How can I print the incoming data as Bytes?

    I'm Waiting For You About This Issue, Good Work ...

    using DevComponents.DotNetBar.Metro;
    using System;
    using System.Windows.Forms;
    
    namespace VeriOkuma
    {
        public partial class VeriOkuma : MetroForm
        {
            public VeriOkuma()
            {
                InitializeComponent();
                Control.CheckForIllegalCrossThreadCalls = false;
            }
    
            private void BTNVeriGonder_Click(object sender, EventArgs e)
            {
                if (!SerialPortTLB.IsOpen)
                    SerialPortTLB.Open();
                SerialPortTLB.Write(System.Convert.ToChar(2).ToString() + System.Convert.ToChar(1).ToString() + "DNG" + System.Convert.ToChar(13).ToString());
            }
    
            private void VeriOkuma_Load(object sender, EventArgs e)
            {
                if (SerialPortTLB.IsOpen)
                {
                    SerialPortTLB.Close();
                }
            }
    
            private void SerialPortTLB_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
            {
                if (!SerialPortTLB.IsOpen) SerialPortTLB.Open();
                TXBGelenVeri.Text = SerialPortTLB.ReadExisting();
                SerialPortTLB.Close();
            }
        }
    }
    


    System and Infrastructure Manager

    Wednesday, March 28, 2018 12:27 PM

All replies

  • Hi,

    Welcome to MSDN forum.

    This forum is discussing Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor. 

    You can open a new thread in the forum to talk about your problem. Thank you for the understanding.

    Best regards,

    Joyce


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 29, 2018 6:57 AM