Click here to Skip to main content
15,911,785 members
Home / Discussions / C#
   

C#

 
QuestionDataGridView - Binding to an Object Pin
BigPMcCoy26-Jul-07 6:55
BigPMcCoy26-Jul-07 6:55 
QuestionDataGridView Checkbox not populating when binding from ObjectDataSource [modified] Pin
Tristan Rhodes26-Jul-07 6:28
Tristan Rhodes26-Jul-07 6:28 
AnswerRe: DataGridView Checkbox not populating when binding from ObjectDataSource Pin
Eliz.k26-Jul-07 21:39
Eliz.k26-Jul-07 21:39 
GeneralRe: DataGridView Checkbox not populating when binding from ObjectDataSource Pin
Tristan Rhodes26-Jul-07 23:25
Tristan Rhodes26-Jul-07 23:25 
QuestionDataSet - mapping the colums Pin
auloepid26-Jul-07 5:23
auloepid26-Jul-07 5:23 
AnswerRe: DataSet - mapping the colums Pin
Tarakeshwar Reddy26-Jul-07 5:31
professionalTarakeshwar Reddy26-Jul-07 5:31 
QuestionSerial To USB Communication Pin
Michael Fritzius26-Jul-07 4:41
professionalMichael Fritzius26-Jul-07 4:41 
AnswerRe: Serial To USB Communication Pin
led mike26-Jul-07 5:00
led mike26-Jul-07 5:00 
GeneralRe: Serial To USB Communication Pin
Michael Fritzius26-Jul-07 5:15
professionalMichael Fritzius26-Jul-07 5:15 
GeneralRe: Serial To USB Communication Pin
led mike26-Jul-07 5:20
led mike26-Jul-07 5:20 
AnswerRe: Serial To USB Communication Pin
Luc Pattyn26-Jul-07 5:20
sitebuilderLuc Pattyn26-Jul-07 5:20 
GeneralRe: Serial To USB Communication Pin
Michael Fritzius26-Jul-07 6:06
professionalMichael Fritzius26-Jul-07 6:06 
GeneralRe: Serial To USB Communication Pin
Luc Pattyn26-Jul-07 6:15
sitebuilderLuc Pattyn26-Jul-07 6:15 
GeneralRe: Serial To USB Communication Pin
Michael Fritzius26-Jul-07 6:55
professionalMichael Fritzius26-Jul-07 6:55 
GeneralRe: Serial To USB Communication Pin
Michael Fritzius26-Jul-07 7:37
professionalMichael Fritzius26-Jul-07 7:37 
GeneralRe: Serial To USB Communication Pin
Luc Pattyn26-Jul-07 7:52
sitebuilderLuc Pattyn26-Jul-07 7:52 
GeneralRe: Serial To USB Communication Pin
Michael Fritzius30-Jul-07 6:21
professionalMichael Fritzius30-Jul-07 6:21 
GeneralRe: Serial To USB Communication Pin
Luc Pattyn30-Jul-07 7:47
sitebuilderLuc Pattyn30-Jul-07 7:47 
GeneralRe: Serial To USB Communication Pin
Michael Fritzius30-Jul-07 6:53
professionalMichael Fritzius30-Jul-07 6:53 
GeneralRe: Serial To USB Communication Pin
Luc Pattyn30-Jul-07 7:03
sitebuilderLuc Pattyn30-Jul-07 7:03 
GeneralRe: Serial To USB Communication Pin
Michael Fritzius30-Jul-07 7:09
professionalMichael Fritzius30-Jul-07 7:09 
GeneralRe: Serial To USB Communication Pin
Luc Pattyn30-Jul-07 7:34
sitebuilderLuc Pattyn30-Jul-07 7:34 
GeneralRe: Serial To USB Communication Pin
Luc Pattyn30-Jul-07 7:38
sitebuilderLuc Pattyn30-Jul-07 7:38 
GeneralRe: Serial To USB Communication Pin
Michael Fritzius30-Jul-07 7:49
professionalMichael Fritzius30-Jul-07 7:49 
Here's what I have for initializing the ports:

            serialPort1.ReadTimeout = 1000;<br />
            serialPort1.BaudRate = 115200;<br />
            serialPort1.StopBits = StopBits.One;<br />
            serialPort1.Parity = Parity.None;<br />
            serialPort1.DataBits = 8;<br />
            serialPort1.RtsEnable = true;<br />
            serialPort1.PortName = "COM1";<br />
            serialPort1.Encoding = Encoding.ASCII;<br />
            //serialPort1.Open();<br />
<br />
            serialPort2.ReadTimeout = 1000;<br />
            serialPort2.BaudRate = 115200;<br />
            serialPort2.StopBits = StopBits.One;<br />
            serialPort2.Parity = Parity.None;<br />
            serialPort2.DataBits = 8;<br />
            serialPort2.RtsEnable = true;<br />
            serialPort2.PortName = "COM5";<br />
            serialPort2.Encoding = Encoding.ASCII;<br />
            //serialPort2.Open();


I added a couple of buttons that can turn on/off the ports on the fly, so I can test with HyperTerminal if needed. But both port have RTS line enabled. The ports aren't opened immediately after the program starts, but the settings are set. Just press a button and go for it. port 1 is the RS232 and port 5 is the USB.

Here's how I handle sending/receiving messages:

        private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)<br />
        {<br />
            txtfromusb.Text += (serialPort1.ReadExisting());<br />
        }<br />
<br />
        private void serialPort2_DataReceived(object sender, SerialDataReceivedEventArgs e)<br />
        {<br />
            txtfromrs232.Text += (serialPort2.ReadExisting());<br />
        }<br />
        <br />
        private void sendfromrs232btn_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                //write line to USB port<br />
                sendtextfromrs232.Text += "\r";<br />
                serialPort1.WriteLine(sendtextfromrs232.Text);<br />
                //clear the text box<br />
                sendtextfromrs232.Text = "";<br />
                baudRatelLabel.Text = "Ready";<br />
            }<br />
            catch (System.Exception ex)<br />
            {<br />
                baudRatelLabel.Text = ex.Message;<br />
            }<br />
        }<br />
        <br />
        private void sendtextfromrs232_Click(object sender, EventArgs e)<br />
        {<br />
            sendtextfromrs232.Clear();<br />
        }<br />
<br />
        private void sendtxtfromusb_Click(object sender, EventArgs e)<br />
        {<br />
            sendtxtfromusb.Clear();<br />
        }<br />
<br />
        private void sendfromusbbtn_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                //write line to serial port<br />
                sendtxtfromusb.Text += "\r";<br />
                serialPort2.WriteLine(sendtxtfromusb.Text);<br />
                //clear the text box<br />
                sendtxtfromusb.Text = "";<br />
                baudRatelLabel.Text = "Ready";<br />
            }<br />
            catch (System.Exception ex)<br />
            {<br />
                baudRatelLabel.Text = ex.Message;<br />
            }<br />
<br />
        }<br />


Oh I am so stuck Poke tongue | ;-P Can I send you the entire project? I know you said you were working on something similar, so if you have the hardware ready, maybe you can get further than I have.

Take care,
Michael Fritzius
GeneralRe: Serial To USB Communication Pin
Luc Pattyn30-Jul-07 7:56
sitebuilderLuc Pattyn30-Jul-07 7:56 

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.