todd@uhunix1.uhcc.Hawaii.Edu (Todd Ogasawara) (02/17/91)
I'm obviously doing something wrong in WordBASIC, but I can't figure out what. Here's the situation. I built a WordBASIC dialog box with an OKButton, a CancelButton, and a ListBox. If I choose the OKButtong, I get the expected results and can proceed with the next action based on my list selection. However, I run into problems when I press CancelButton and want to act on it. The WordBASIC ref manual says that I can use On Error Goto 0 to ignore the error generated by CancelButton and use the Err value that is returned. However, using 'On Error Goto 0' doesn't seem to do anything. I still get a runtime error and cannot process the error code returned by Err. I tried 'On Error Resume Next' and that seems to work as advertised (the cancel generated error is ignored and the next WordBASIC instruction is processed). Any hints would be appreciated...todd -- Todd Ogasawara, U. of Hawaii UUCP: {uunet,ucbvax,dcdwest}!ucsd!nosc!uhunix!todd BITNET: todd@uhunix INTERNET: todd@uhunix.UHCC.HAWAII.EDU
gg2@cunixf.cc.columbia.edu (Guy Gallo) (02/21/91)
You need to place an On Error Goto EndLabel on the line *before* the statement accepting cancel. So, for instance, in displaying a dialog box you would have <dialog definition> ... On Error Goto EndLabelName Dialog Dlg On Error Goto 0 ... Statements when not cancelled ... EndLabelName 'Marks the end of the macro End Sub You might be interested to know that Microsoft is giving away a short (170) page introduction to WordBASIC called Using WordBASIC. Call 1-800-426-9400 and ask for the WordBASIC Binder for the PC (there is also one for the Mac, be specific), part number 059-050-574. Not every operator is up on this promotion: but be assured, the first copy of Using WordBASIC is free. Additional copies are 15.00. Also, there is a new addition of the Technical Reference.