Click here to Skip to main content
15,899,754 members
Home / Discussions / C#
   

C#

 
AnswerRe: About downloading file Pin
Shyam K Pananghat23-Feb-09 3:18
Shyam K Pananghat23-Feb-09 3:18 
QuestionDataGrid Textbox will not apply value unless enter is pushed Pin
Brad Wick15-Jan-09 17:46
Brad Wick15-Jan-09 17:46 
AnswerRe: DataGrid Textbox will not apply value unless enter is pushed Pin
Aghosh Babu15-Jan-09 18:05
Aghosh Babu15-Jan-09 18:05 
GeneralRe: DataGrid Textbox will not apply value unless enter is pushed Pin
Brad Wick16-Jan-09 6:20
Brad Wick16-Jan-09 6:20 
AnswerRe: DataGrid Textbox will not apply value unless enter is pushed Pin
Mogesh17-Apr-09 0:35
Mogesh17-Apr-09 0:35 
QuestionHow to read from Serial (COM) Port? [modified] Pin
Aghosh Babu15-Jan-09 16:36
Aghosh Babu15-Jan-09 16:36 
AnswerRe: How to read from Serial (COM) Port? Pin
lincyang15-Jan-09 19:57
lincyang15-Jan-09 19:57 
AnswerRe: How to read from Serial (COM) Port? Pin
Bharat Jain15-Jan-09 21:34
Bharat Jain15-Jan-09 21:34 
Hi Aghosh Babu,

It seems like you are try to build an application which send SMS using a connect Phone , and the serial port you are using (COM6) is a virtual serial port (port used to connect to through buletooth or USB ) , so please make sure that you com6 is working , by using Apllication like Hyper Terminal (it comes with windows XP) , try to send AT , and recive OK , if its is working over there , than you can try it in your code (dont forget to disconnect hyper terminal bepore try from you code , other wise it will give error , say port already in use).

I have used the following code recive data that arrives on serial port

private static void SerialPortDataReceived(object sender, SerialDataReceivedEventArgs e)

{
           if (_serialPort.BytesToRead > 0)
            {
                int bytesToRead = _serialPort.BytesToRead;
                byte[] dataRead = new byte[bytesToRead];
                string linedata;
                _serialPort.Read(dataRead, 0, bytesToRead);
                 linedata =  ConvertToString(dataRead);
             }
}

       private string ConvertToString(IEnumerable<byte> ByteArray)
        {
            //This Function converts an Byte Array to string , This we 
            // nned to do because if we directly try to read srting ,
            // From the com port , it take Unicode encoding , we need ASCII encoding
            // Hence we need to 
            string tempStringToReturn = string.Empty;
            foreach (byte bt in ByteArray)
            {
                tempStringToReturn = tempStringToReturn + Convert.ToChar(bt);
            }
            return tempStringToReturn;
        }</byte>


In the above code SerialPortDataReceived is a event of serial port object , this event is raised when there data arrives on the serial port .

Try out with above information , see if it helps , i need to move now , let me know if you find any problem regarding the same

-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com

GeneralRe: How to read from Serial (COM) Port? Pin
Aghosh Babu18-Jan-09 17:34
Aghosh Babu18-Jan-09 17:34 
GeneralRe: How to read from Serial (COM) Port? Pin
Bharat Jain26-Jan-09 20:24
Bharat Jain26-Jan-09 20:24 
QuestionPass Data between forms Pin
Illegal Operation15-Jan-09 13:45
Illegal Operation15-Jan-09 13:45 
AnswerRe: Pass Data between forms Pin
Colin Angus Mackay15-Jan-09 14:09
Colin Angus Mackay15-Jan-09 14:09 
Questionline break syntax for tooltip on asp.net hyperlink control Pin
Lara Nabozny15-Jan-09 12:44
Lara Nabozny15-Jan-09 12:44 
AnswerRe: line break syntax for tooltip on asp.net hyperlink control Pin
EliottA15-Jan-09 12:59
EliottA15-Jan-09 12:59 
GeneralRe: line break syntax for tooltip on asp.net hyperlink control Pin
Lara Nabozny15-Jan-09 13:05
Lara Nabozny15-Jan-09 13:05 
GeneralRe: line break syntax for tooltip on asp.net hyperlink control Pin
EliottA15-Jan-09 13:13
EliottA15-Jan-09 13:13 
GeneralRe: line break syntax for tooltip on asp.net hyperlink control Pin
Vikram A Punathambekar15-Jan-09 18:02
Vikram A Punathambekar15-Jan-09 18:02 
GeneralRe: line break syntax for tooltip on asp.net hyperlink control Pin
Lara Nabozny16-Jan-09 4:31
Lara Nabozny16-Jan-09 4:31 
GeneralRe: line break syntax for tooltip on asp.net hyperlink control Pin
Vikram A Punathambekar16-Jan-09 4:51
Vikram A Punathambekar16-Jan-09 4:51 
GeneralRe: line break syntax for tooltip on asp.net hyperlink control Pin
Lara Nabozny16-Jan-09 4:55
Lara Nabozny16-Jan-09 4:55 
Question[REQ: Help] Neural Network Pin
MavKilla15-Jan-09 12:38
MavKilla15-Jan-09 12:38 
Questionhow can made student form application in C#.net and login form?please send me coding and tutorial Pin
mohammedali200615-Jan-09 11:28
mohammedali200615-Jan-09 11:28 
AnswerRe: how can made student form application in C#.net and login form?please send me coding and tutorial Pin
User 665815-Jan-09 11:53
User 665815-Jan-09 11:53 
Generalwhich books is best? Pin
mohammedali200615-Jan-09 12:12
mohammedali200615-Jan-09 12:12 
GeneralRe: which books is best? Pin
EliottA15-Jan-09 12:17
EliottA15-Jan-09 12:17 

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.