I am trying to get only weight from the scale to my application I try some codes but its doesn't work
I am using this code :
namespace WS_POS
{
    public partial class Test1 : XtraForm
    {
        static SerialPort _serialPort;        
        private const int BaudRate = 9600;
        public Test1()
        {
            InitializeComponent();
        }
        private void Test1_Load(object sender, EventArgs e)
        {
            string[] portNames = SerialPort.GetPortNames();     
            foreach (var portName in portNames)
            {
                comboBox1.Items.Add(portName);                  
            }
            comboBox1.SelectedIndex = 0;
        }
        private delegate void Closure();
        private void SerialPortOnDataReceived(object sender, SerialDataReceivedEventArgs serialDataReceivedEventArgs)
        {
            if (InvokeRequired)     
                BeginInvoke(new Closure(() => { SerialPortOnDataReceived(sender, serialDataReceivedEventArgs); }));    
            else
            {
                int dataLength = _serialPort.BytesToRead;
                byte[] data = new byte[dataLength];
                int nbrDataRead = _serialPort.Read(data, 0, dataLength);
                if (nbrDataRead == 0)
                    return;
                string str = System.Text.Encoding.UTF8.GetString(data);
                T2.Text = str.ToString();
            }
        }
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (_serialPort != null && _serialPort.IsOpen)
                _serialPort.Close();
            if (_serialPort != null)
                _serialPort.Dispose();
   
            _serialPort = new SerialPort(comboBox1.Text, BaudRate, Parity.None, 8, StopBits.One);       //<-- Creates new SerialPort using the name selected in the combobox
            _serialPort.DataReceived += SerialPortOnDataReceived;       //<-- this event happens everytime when new data is received by the ComPort
            _serialPort.Open();     //<-- make the comport listen
            T1.Text = "Listening on " + _serialPort.PortName + "...\r\n";
        }
    }
}
I need only get weight to text box because I needed to used for POS program
I try various snippets of code, but nothing works for me; I need to send weight from scale and receive data in my app in textbox.
Can anyone help me with this situation?