By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,457 Members | 1,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,457 IT Pros & Developers. It's quick & easy.

Any ways to force the Program to halt?

P: n/a
Hi, I have a problem here.

Referring to the following programming structure, is there a way to cause
the computer to overflow or stop by inputting wrong values of intTime
and/or intDay? i.e. I don't want the program to jump to label NotWritten:.
but want the program to stop working when the input values are of wrong
types.

Thanks a Million
##
On Error GoTo NotWritten:
Open "c:\windows\system\aaa.txt" For Input As #f1
Line Input #f1, strJustStr1
Input #f1, intTime, intDay
Line Input #f1, strJustStr2
Close
If (intTime Mod 75) <> 0 Or (intDay Mod 79) <> 0 Then
......
End If
.......
.......

NotWritten:
.... (other statements follow)

##

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Assuming I understand what you are trying to do, if you put the statement:
On Error Goto 0
After the "Close" statement it will turn off error handling and allow the
code to break on any line producing an error during development. Depending
of course on the options you have set for error handling.
--
Jeffrey R. Bailey
"kochs" <gm*******@yahoo.com.sg> wrote in message
news:41********@news.starhub.net.sg...
Hi, I have a problem here.

Referring to the following programming structure, is there a way to cause
the computer to overflow or stop by inputting wrong values of intTime
and/or intDay? i.e. I don't want the program to jump to label NotWritten:.
but want the program to stop working when the input values are of wrong
types.

Thanks a Million
##
On Error GoTo NotWritten:
Open "c:\windows\system\aaa.txt" For Input As #f1
Line Input #f1, strJustStr1
Input #f1, intTime, intDay
Line Input #f1, strJustStr2
Close
If (intTime Mod 75) <> 0 Or (intDay Mod 79) <> 0 Then
.....
End If
......
......

NotWritten:
... (other statements follow)

##

Jul 17 '05 #2

P: n/a
Actually, the 3 lines

Line Input #f1, strJustStr1
Input #f1, intTime, intDay
Line Input #f1, strJustStr2

are supposed to function as check and cause the function to halt e.g. if
strJustStr1 or strJustStr2 are not string or if intTime or intDay are not
integer. However, I have put in the On Error Goto statement, which now
prevents the intended check. No matter what value I give to these numbers,
the function just ignores them and jump to the NotWritten statement.

I am now wondering if there are any integers which I can supply to
intTime/intDay to cause the function to halt when it executes these
statement.

Any help?

"Jeffrey R. Bailey" <Mr******************@yahoo.com> wrote in message
news:B5******************@tornado.tampabay.rr.com. ..
Assuming I understand what you are trying to do, if you put the statement:
On Error Goto 0
After the "Close" statement it will turn off error handling and allow the
code to break on any line producing an error during development. Depending of course on the options you have set for error handling.
--
Jeffrey R. Bailey
"kochs" <gm*******@yahoo.com.sg> wrote in message
news:41********@news.starhub.net.sg...
Hi, I have a problem here.

Referring to the following programming structure, is there a way to cause the computer to overflow or stop by inputting wrong values of intTime
and/or intDay? i.e. I don't want the program to jump to label NotWritten:. but want the program to stop working when the input values are of wrong
types.

Thanks a Million
##
On Error GoTo NotWritten:
Open "c:\aaa.txt" For Input As #f1
Line Input #f1, strJustStr1
Input #f1, intTime, intDay
Line Input #f1, strJustStr2
Close
If (intTime Mod 75) <> 0 Or (intDay Mod 79) <> 0 Then
.....
End If
......
......

NotWritten:
... (other statements follow)

##


Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.