Click here to Skip to main content
15,898,957 members
Home / Discussions / C#
   

C#

 
QuestionIrDA - Infrared Pin
iqueiroz8-Feb-07 23:25
iqueiroz8-Feb-07 23:25 
AnswerRe: IrDA - Infrared Pin
m@u8-Feb-07 23:34
m@u8-Feb-07 23:34 
GeneralRe: IrDA - Infrared Pin
iqueiroz8-Feb-07 23:51
iqueiroz8-Feb-07 23:51 
GeneralRe: IrDA - Infrared Pin
m@u9-Feb-07 1:20
m@u9-Feb-07 1:20 
AnswerRe: IrDA - Infrared Pin
Ed.Poore8-Feb-07 23:49
Ed.Poore8-Feb-07 23:49 
GeneralRe: IrDA - Infrared Pin
iqueiroz8-Feb-07 23:52
iqueiroz8-Feb-07 23:52 
GeneralRe: IrDA - Infrared Pin
Ed.Poore9-Feb-07 1:43
Ed.Poore9-Feb-07 1:43 
AnswerRe: IrDA - Infrared Pin
Bekjong9-Feb-07 0:25
Bekjong9-Feb-07 0:25 
First of all it would be a good idea to check all ports on your computer first. I use it like this.

public enum PortAvailabillity
        {
            Available, InUse
        }

 public static Dictionary<int, PortAvailabillity> GetPorts()
        {
            string[] availablePorts = SerialPort.GetPortNames();
            Dictionary<int, PortAvailabillity> portStatus = new Dictionary<int,PortAvailabillity>();

            foreach (string s in availablePorts)
            {
                int number = int.Parse(s[s.Length - 1].ToString());

                try
                {
                    SerialPort p = new SerialPort(s);

                    if (!p.IsOpen)
                        portStatus.Add(number, PortAvailabillity.Available);
                    else
                        portStatus.Add(number, PortAvailabillity.InUse);

                }
                catch (IOException err )
                {
                    #if DEBUG
                    Console.WriteLine("Error getting port: " + err.ToString());
                    #endif
                }
            }

            return portStatus;
        }


Also you might want to set some more parameters when opening the port (baudrate and such). Always make sure no other program is using the port when you try this.


Standards are great! Everybody should have one!

GeneralRe: IrDA - Infrared Pin
iqueiroz9-Feb-07 0:35
iqueiroz9-Feb-07 0:35 
QuestionOverriding OnMouseWheel Pin
Bekjong8-Feb-07 22:51
Bekjong8-Feb-07 22:51 
AnswerRe: Overriding OnMouseWheel Pin
Thomas Stockwell9-Feb-07 1:56
professionalThomas Stockwell9-Feb-07 1:56 
GeneralRe: Overriding OnMouseWheel Pin
Bekjong9-Feb-07 2:07
Bekjong9-Feb-07 2:07 
AnswerRe: Overriding OnMouseWheel Pin
BoneSoft5-May-11 3:33
BoneSoft5-May-11 3:33 
JokeRe: Overriding OnMouseWheel Pin
Bekjong5-May-11 16:33
Bekjong5-May-11 16:33 
Questionplz help on a query. Pin
Nekshan8-Feb-07 22:42
Nekshan8-Feb-07 22:42 
AnswerRe: plz help on a query. Pin
coolestCoder8-Feb-07 22:48
coolestCoder8-Feb-07 22:48 
GeneralRe: plz help on a query. Pin
Colin Angus Mackay8-Feb-07 22:55
Colin Angus Mackay8-Feb-07 22:55 
AnswerRe: plz help on a query. Pin
Christian Graus8-Feb-07 22:51
protectorChristian Graus8-Feb-07 22:51 
AnswerRe: plz help on a query. Pin
Stefan Troschuetz8-Feb-07 22:54
Stefan Troschuetz8-Feb-07 22:54 
AnswerRe: plz help on a query. Pin
Colin Angus Mackay8-Feb-07 22:58
Colin Angus Mackay8-Feb-07 22:58 
Question[Message Deleted] Pin
Nekshan8-Feb-07 22:22
Nekshan8-Feb-07 22:22 
AnswerRe: get a value from database into a variable. Pin
coolestCoder8-Feb-07 22:27
coolestCoder8-Feb-07 22:27 
AnswerRe: get a value from database into a variable. Pin
Stefan Troschuetz8-Feb-07 22:28
Stefan Troschuetz8-Feb-07 22:28 
AnswerRe: get a value from database into a variable. Pin
m@u8-Feb-07 22:29
m@u8-Feb-07 22:29 
AnswerRe: get a value from database into a variable. Pin
coolestCoder8-Feb-07 22:29
coolestCoder8-Feb-07 22:29 

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.