Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validate a comm port
Message
 
À
11/10/2002 11:59:59
Information générale
Forum:
Visual FoxPro
Catégorie:
CodeMine
Divers
Thread ID:
00710381
Message ID:
00710395
Vues:
16
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform