Visual Studio Development Bookmark and Share   
 index > Visual Basic Express Edition > Scheduled Events (serialport)
 

Scheduled Events (serialport)

My program is scheduled to run from 00:00 until 23:59. On the new day the data has to be written on the new day file and the graph will start plotting from begining.
I tried and it does stop at 23:59pm, and everything inside the graph are erased,when 00:00 arrives, It starts plotting from begining again (which is correct), butan error occurs whichsays:
unhandled exception has occured in your app (Access to port COM1 is denied).
Private Shared writer As StreamWriter = New StreamWriter("c:\beacon\" & Now.Day & "_" & Now.Month & "_" & Now.Year & ".txt")

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick


If DateTime.Now.ToString("HH:mm") = "23:59" Then
yValues.Clear()
average.Clear()
buffer.Clear()

Me.Refresh()
System.Threading.Thread.Sleep(1000)

Else
>>normal operation here

yValues.Add(buffer(i))
'write the data inside txt file at the same time
writer.Write(buffer(i) & vbCrLf)
writer.Flush()




End if

end sub
wencey  Thursday, March 15, 2007 1:21 PM

wencey,

According to your error message Access to port COM1 is denied, I recommend you to read the related information on the problem.

1. You can't have multiple handles open on a serial port. Windows couldn't possibly determine which handle should see the bytes that were received. You could implement sharing yourself by having a singleton object manage traffic.

http://forums.microsoft.com/msdn/showpost.aspx?postid=567405&siteid=1

2. No dotNet help here but.... you may have a device that's tying up Com1 and
not even know it. Mouse drivers are famous for that.

See: Available switch options for the Windows XP and the Windows Server 2003
Boot.ini files
http://support.microsoft.com/kb/833721/en-us

http://support.microsoft.com/kb/833721/en-us

http://www.thescripts.com/forum/thread524785.html


Bruno Yu  Friday, March 23, 2007 3:31 AM
You're probably trying to Open() the serial port again when it is already opened by your program.
nobugz  Friday, March 23, 2007 7:00 PM

wencey,

According to your error message Access to port COM1 is denied, I recommend you to read the related information on the problem.

1. You can't have multiple handles open on a serial port. Windows couldn't possibly determine which handle should see the bytes that were received. You could implement sharing yourself by having a singleton object manage traffic.

http://forums.microsoft.com/msdn/showpost.aspx?postid=567405&siteid=1

2. No dotNet help here but.... you may have a device that's tying up Com1 and
not even know it. Mouse drivers are famous for that.

See: Available switch options for the Windows XP and the Windows Server 2003
Boot.ini files
http://support.microsoft.com/kb/833721/en-us

http://support.microsoft.com/kb/833721/en-us

http://www.thescripts.com/forum/thread524785.html


Bruno Yu  Friday, March 23, 2007 3:31 AM
You're probably trying to Open() the serial port again when it is already opened by your program.
nobugz  Friday, March 23, 2007 7:00 PM

You can use google to search for other answers

Custom Search

More Threads

• stripping text from a text field
• Splitting A large Tab Delimited TXT File (Index was outside the bounds of the array)
• Who do I consult if an issue occurs during the registration or installation process of Visual Basic Express?
• Why does this not Work?
• What is the code for a "blank" textbox
• I dont know where else to ask..... AutoPlay Menu made in VB Express
• Saving TXT with proper spacing.
• property binding to a setting
• Bind combo box Items to application setting?
• visual basic question