473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

C#.NET - use ComboBox value to set serial port property

Hello everyone here!

Can anybody tell me how can I use item in a ComboBox as the serial port property like StopBits and Parity.

I have been using the following syntax to set the BaudRate, DataBits and PortName:
this.serialPort1.BaudRate = int.Parse(this.comboBox2.Text);
this.serialPort1.PortName = this.comboBox1.Text;
this.serialPort1.DataBits = int.Parse(this.comboBox4.Text);


But I dunno how can i set the StopBits and Parity.

Can anybody here kindly help me? thank you very much!
Mar 28 '07 #1
3 9702
already solved.
Mar 30 '07 #2
kenobewan
4,871 Expert 4TB
Well done! Care to share the solution?
Mar 30 '07 #3
Here is how I solve this problem:
serialPort1.PortName = comboBox1.Text;
serialPort1.BaudRate = int.Parse(comboBox2.Text);
serialPort1.Parity = (Parity)Enum.Parse(typeof(Parity), comboBox3.Text);
serialPort1.DataBits = int.Parse(comboBox4.Text);
serialPort1.StopBits = (StopBits)Enum.Parse(typeof(StopBits), stopBits);
Apr 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jacob | last post by:
Has anyone successfully received serial communications from a COM port/RS232C device? It's easy to connect and write to a serial device with Framework 2.0, but when I try to read from the input...
2
by: fdunne2 | last post by:
Hi, I need to interface a signal generator with my computer's serial port ( to set the frequency, level etc using the appropriate byte codes). How can I send and receive (acknowledge the message...
6
by: Peter Krikelis | last post by:
Hi All, I am having a problem setting up input mode for serial communications. (Sorry about the long code post). The following code is what I use to set up my comm port.
13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
2
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following...
2
by: shayke via DotNetMonster.com | last post by:
Hello, I am trying to write asynchronous serial port. meaning, read and write operations are made via async cllbacks. so far so good. I open my port in continues state: 1)Set the BytesToRead...
7
by: davetelling | last post by:
I'm a newbie that is still struggling with OOP concepts & how to make things work they way I want. Using Visual C# Express, I have a form in which I added a user control to display a graph, based...
13
by: Rob | last post by:
Hi all, I am fairly new to python, but not programming and embedded. I am having an issue which I believe is related to the hardware, triggered by the software read I am doing in pySerial. I...
4
by: cmdolcet69 | last post by:
This code below write a serial command to the com port then read the results and disaplays it into the label1.text property when button1_click event is triggered. I think what is going on is that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.