Click here to Skip to main content
15,792,510 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem with string array? Pin
OriginalGriff4-Jul-23 19:21
mvaOriginalGriff4-Jul-23 19:21 
GeneralRe: Problem with string array? Pin
jschell5-Jul-23 6:28
jschell5-Jul-23 6:28 
QuestionPredicateBuilder Question Pin
Kevin Marois30-Jun-23 9:54
professionalKevin Marois30-Jun-23 9:54 
AnswerRe: PredicateBuilder Question Pin
Dave Kreskowiak1-Jul-23 5:23
mveDave Kreskowiak1-Jul-23 5:23 
GeneralRe: PredicateBuilder Question Pin
Kevin Marois1-Jul-23 9:21
professionalKevin Marois1-Jul-23 9:21 
AnswerRe: PredicateBuilder Question Pin
BillWoodruff1-Jul-23 10:54
professionalBillWoodruff1-Jul-23 10:54 
AnswerRe: PredicateBuilder Question Pin
James Curran5-Jul-23 11:41
James Curran5-Jul-23 11:41 
QuestionUnable to Receive data from Cobas e411 Serial Port Pin
Member 1493027227-Jun-23 23:20
Member 1493027227-Jun-23 23:20 
Hi, I am new to this platform also new to C# code. I want to communicate with my Cobas e411 machine and receive data in text box but no data being received.
here is my code what i used. Kindly help

Kindly share the code for receiving the data from machine. I tried but its not working. No Data being received. My code is below.

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;

namespace New_Interfacing
{
    public partial class Form1 : Form
    {

        private SerialPort _serialPort;         
        private const int BaudRate = 9600;      


        public Form1()
        {
            InitializeComponent();
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            string[] portNames = SerialPort.GetPortNames();     
            foreach (var portName in portNames)
            {
                comboBox1.Items.Add(portName);                  
            }
            comboBox1.SelectedIndex = 0;                       

        }
        private void button1_Click(object sender, EventArgs e)
        {
           
       
         
          
            _serialPort = new SerialPort(comboBox1.Text, BaudRate, Parity.None, 8, StopBits.One);      
            _serialPort.DataReceived += SerialPortOnDataReceived;
            _serialPort.Open();
            textBox1.Text = "Listening on " + comboBox1.Text + "...";
        }

        private delegate void Closure();
        private void SerialPortOnDataReceived(object sender, SerialDataReceivedEventArgs serialDataReceivedEventArgs)
        {
            if (InvokeRequired)    
                BeginInvoke(new Closure(() => { SerialPortOnDataReceived(sender, serialDataReceivedEventArgs); }));     
            else
            {
                while (_serialPort.BytesToRead > 0) //<-- repeats until the In-Buffer is empty
                {
                    textBox1.Text += string.Format("{0:X2} ", _serialPort.ReadByte());
                
                }
            }
        }


    }
}


modified 28-Jun-23 5:33am.

AnswerRe: Unable to Receive data from Cobas e411 Serial Port Pin
Richard MacCutchan28-Jun-23 0:08
mveRichard MacCutchan28-Jun-23 0:08 
AnswerRe: Unable to Receive data from Cobas e411 Serial Port Pin
OriginalGriff28-Jun-23 0:38
mvaOriginalGriff28-Jun-23 0:38 
AnswerRe: Unable to Receive data from Cobas e411 Serial Port Pin
Ralf Meier28-Jun-23 1:43
professionalRalf Meier28-Jun-23 1:43 
AnswerRe: Unable to Receive data from Cobas e411 Serial Port Pin
jschell28-Jun-23 7:08
jschell28-Jun-23 7:08 
GeneralRe: Unable to Receive data from Cobas e411 Serial Port Pin
Member 1493027228-Jun-23 7:21
Member 1493027228-Jun-23 7:21 
AnswerRe: Unable to Receive data from Cobas e411 Serial Port Pin
Gerry Schmitz28-Jun-23 7:51
mveGerry Schmitz28-Jun-23 7:51 
QuestionGoogle PeopleAPI & HttpListener Redirect URI Pin
Kevin Marois22-Jun-23 11:03
professionalKevin Marois22-Jun-23 11:03 
AnswerRe: Google PeopleAPI & HttpListener Redirect URI Pin
jschell23-Jun-23 11:45
jschell23-Jun-23 11:45 
GeneralRe: Google PeopleAPI & HttpListener Redirect URI Pin
Kevin Marois23-Jun-23 13:18
professionalKevin Marois23-Jun-23 13:18 
GeneralRe: Google PeopleAPI & HttpListener Redirect URI Pin
Richard Andrew x6425-Jun-23 12:44
professionalRichard Andrew x6425-Jun-23 12:44 
GeneralRe: Google PeopleAPI & HttpListener Redirect URI Pin
Kevin Marois25-Jun-23 18:41
professionalKevin Marois25-Jun-23 18:41 
GeneralRe: Google PeopleAPI & HttpListener Redirect URI Pin
jschell26-Jun-23 6:31
jschell26-Jun-23 6:31 
GeneralRe: Google PeopleAPI & HttpListener Redirect URI Pin
Kevin Marois26-Jun-23 9:20
professionalKevin Marois26-Jun-23 9:20 
GeneralRe: Google PeopleAPI & HttpListener Redirect URI Pin
Kevin Marois26-Jun-23 17:19
professionalKevin Marois26-Jun-23 17:19 
GeneralRe: Google PeopleAPI & HttpListener Redirect URI Pin
jschell27-Jun-23 5:48
jschell27-Jun-23 5:48 
General[UPDATE] - Google PeopleAPI & HttpListener Redirect URI Pin
Kevin Marois27-Jun-23 7:01
professionalKevin Marois27-Jun-23 7:01 
GeneralRe: [UPDATE] - Google PeopleAPI & HttpListener Redirect URI Pin
jschell28-Jun-23 6:54
jschell28-Jun-23 6:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.