Announcement

Collapse
No announcement yet.

Testing & Debugging program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Testing & Debugging program

    I am using Visual BASIC 6.0 to write a new version of a program that controls my model train layout. I don't want to run the trains all day long while testing and debugging the program. I am worried about the possibility of a train accident while testing and debugging the program. Is it possible for me to temporarily replace some routines in the program with keyboard control routines?

    Private Sub checksensor01()
    Do Until CtiData.SensorData(0) = 1
    CtiData.ReasonForCall = CTI_DATA_EXCHANGE
    CtiCommunicate CtiData
    UpdateNetworkStatus
    DoEvents
    Loop
    wait (0.2)
    sensor01 = 1
    End Sub

    Private Sub stopatstation01(string01 As String)
    RichTextBox1.Text = "Stop at " + string01
    communicate (CTI_DATA_EXCHANGE)
    checksensor03
    If sensor03 = 1 Then
    XMCommCRC2.Output = engine02
    wait ((Int((3) * Rnd + 8)))
    XMCommCRC2.Output = engine01
    End If
    End Sub

    These two routines control my model train layout. I think that I could write something like this: if debug = true then keyboard input code. Jeffrey.

    ------------------

  • #2
    Er, Jeffrey, this is a PowerBASIC forum. You may wish to ask this in a VB support site.

    Unless, of course, you are asking how to do this with PowerBASIC?!

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Well, if VB supports conditional compilation, the technique would be the same as with PB....

      (I have no clue if VB supports conditional compilation).

      MCM

      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Lance, Do you know of good VB support site? Jeffrey.

        ------------------

        Comment


        • #5
          Jeffrey, here's half a billion sites to start with http://www.google.com/search?q=%22Visual+Basic%22+help http://www.google.com/search?hl=en&s...yboard+control

          I found your question confusing so Im not sure what you want your VB program to do, but I'd assume you'd be doing something with the KeyPress() event, eg:
          Code:
          Private Sub Form_KeyPress(KeyAscii As Integer)
          If KeyAscii = 13 Then
             KeyAscii = 0
             MsgBox "You pressed Enter but I cancelled the keystroke"
          End If
          End Sub
          Best regards,
          Wayne


          ------------------
          -

          Comment


          • #6
            Do you know of good VB support site?
            If you have a newsreader program, try the Microsoft news server at msnews.microsoft.com. It has dozens of newsgroups for Visual Basic alone.
            If you try to make something idiot-proof, someone will invent a better idiot.

            Comment

            Working...
            X