Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate a comm port
Message
 
To
11/10/2002 11:59:59
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00710381
Message ID:
00710395
Views:
15
>>I tried to intercept the codemine error box but didnt have any luck.
>>when I try the following
>>thisform.mscomm.commport=9 &&this is an invalid port on my pc
>>ON ERROR wait 'invalid port' window
>>thisform.mscomm.portopen=.t.
>>ON ERROR

The form's Error method always overrides an ON ERROR statement.
You may create a separate class to do the job:
o = CreateObject("CommHandler")
result = o.Open(thisform.mscomm)
If result <> 0
	MessageBox("Error " + Transform(result) + " attempting to open comm port")
EndIf 
*--------------------------------
Define Class CommHandler as Line
	ErrValue = 0
	Procedure Open( loComm)
		loComm.portopen = .t.
		Return this.ErrValue
	EndProc 
	
	Procedure Error( nError, cMethod, nLine)
		this.ErrValue = nError
		Return
	EndProc 
Enddefine
Hope this helps
Jose.
------------------
Jose Marcenaro
Tercer Planeta - Argentina
http://www.tercerplaneta.com
Previous
Reply
Map
View

Click here to load this message in the networking platform