Access to COM port is denied

I am trying to test out some functionality when I try and write to a cOM port and I keep getting access to port is denied. I originally open my com port and set it up however Im testing out to see if the device becomes unplugged (which I do do) I get an Access to the port is denied error
COM-Error.png
cmdolcetAsked:
Who is Participating?
 
Bob LearnedCommented:
The obvious first question is, "Is something else using the COM port?"  What type of application are you working with?  Is this running from a network share or other partially trusted environment?
0
 
cmdolcetAuthor Commented:
No nothing should be taking it up. I have attached a screen shot of the serialPort properties. This error only happens when I try to write to the device
COM-Port-Access-Denied.png
0
 
Bob LearnedCommented:
Have you had this working before?  Is this new development work?  I see that the port name is COM30...is that correct?
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
cmdolcetAuthor Commented:
I have not had this working before. You are correct the device is opening COM 30 which is ok with my program
0
 
Bob LearnedCommented:
1) What operating system are you working with?  

2) Are you having UAC issues with Vista/Windows 7?  

3) Is this application running from a network share?
0
 
cmdolcetAuthor Commented:
OK I figured it out. I was keeping a reference to the serial com and not closing it correctly. I am all set now

Thanks for all the help
0
 
Bob LearnedCommented:
Well, that answered the "Is something else using the COM port?" question...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.