Any ways to force the Program to halt? - basic.visual

This is a discussion on Any ways to force the Program to halt? - basic.visual ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Any ways to force the Program to halt?

  1. Default Any ways to force the Program to halt?

    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)

    ##




  2. Default Re: Any ways to force the Program to halt?

    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_assist@yahoo.com.sg> wrote in message
    news:417092db$1@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)
    >
    > ##
    >
    >
    >




  3. Default Re: Any ways to force the Program to halt?

    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" <MrWizard2903RemoveMe@yahoo.com> wrote in message
    news:B5Vcd.18575$vZ5.4412@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_assist@yahoo.com.sg> wrote in message
    > news:417092db$1@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)
    > >
    > > ##
    > >
    > >
    > >

    >
    >




+ Reply to Thread

Similar Threads

  1. Lambda funcs that call gets won't halt program execution?
    By Application Development in forum RUBY
    Replies: 5
    Last Post: 12-06-2007, 04:08 PM
  2. An odd halt in my program
    By Application Development in forum Fortran
    Replies: 10
    Last Post: 09-04-2007, 01:49 PM
  3. Do Write Once TM's Halt?
    By Application Development in forum Theory
    Replies: 21
    Last Post: 02-26-2007, 05:19 AM
  4. Program example to I/O a "Momo Racing Force Feedback Wheel"
    By Application Development in forum Java-Games
    Replies: 3
    Last Post: 09-30-2004, 03:31 AM
  5. Eclipse Debug force a break to a debugged program
    By Application Development in forum Java
    Replies: 1
    Last Post: 08-04-2004, 02:26 PM