Debug in VB IDE

Debug Capability. Start from WebRainbow 1.1, the developers can debug VB program in the Visual Basic IDE. It makes developing easy.

The limitation of this debug capability:

because no real stdin and stdout are associated with VB program when it is running off-line.

We are working on the real debug tool to give VB developer the full capability to debug program in the Visual Basic Integrated Development Environment. It'll be free for the developers.

How to Debug. To debug program in VB IDE:

  1. The WRnbwB.dll should be in the Visual Basic folder. To find the Visual Basic folder, Click on

    Start -> Find -> Files or Folders...

    then search for

    • vb6.exe for Visual Basic 6

    • vb5.exe for Visual Basic 5

    • vb32.exe for 32 bit Visual Basic 4

  2. In the VB program, assign the value to the Form Data and/or the Cookies input variables, then run program step by step (F8).

Here we use the sample program AccessDB to illustrate how to debug program in the VB IDE. Only the Sub Main() is shown bellow (Click the link to see the AccessDB.bas):


    Sub Main()

      Dim iTotalData As Integer
      Dim sLoginMsg As String
      Dim sRegisterMsg As String

      ' Set HTTP method to accept both GET and POST
      SetRequestMethod RequestMethod.hmAuto
  
      ' Get Form data from browser
      iTotalData = CountFormData
      Call ReadFormData
  

  ' These 6 lines, in RED, are only used for debug.
  ' Assign value to input variables for Case 3.
  iTotalData = 3
  gsAction = "login"
  gsUserName = "jsmith"
  gsPassword = "jsmith01"


      Select Case iTotalData
    
        ' Request for "http://.../AccessDB.exe" without Form data
        Case 0
          sLoginMsg = "If you are registered user, please login now:"
          sRegisterMsg = "If you are first time to use this system, please register:"
          Call ShowLogon(sLoginMsg, sRegisterMsg)
      
        ' User try to log in -----------------------------
        '   Form Data:   gsAction      should = "login"
        '                gsUserName
        '                gsPassword
        Case 3
      
          ' Connecting to database
          Call DBOpen
      
          ' Login seccessed
          If UserLogin Then
            Call GetRecord           ' Retrieve records from database
            Call ShowRecord          ' Show records in browser
        
          ' Login failed
          Else
            sLoginMsg = "User Name or/and Password are not correct!"
            sRegisterMsg = "If you are first time to use this system, please register:"
            Call ShowLogon(sLoginMsg, sRegisterMsg)
          End If
      
          ' Close database connection
          Call DBClose
      
        ' User register to this system ---------------------------
        '   Form Data:   gsAction      should = "register"
        '                gsUserName
        '                gsPassword
        '                gsPassword1
        Case 4
    
          ' Handle incomplete register info
          sLoginMsg = "If you are registered user, please login now:"
          If gsUserName = "" Then
            sRegisterMsg = "Please enter User Name:"
            Call ShowLogon(sLoginMsg, sRegisterMsg)
          ElseIf gsPassword = "" Then
            sRegisterMsg = "Please enter Password:"
            Call ShowLogon(sLoginMsg, sRegisterMsg)
          ElseIf gsPassword <> gsPassword1 Then
            sRegisterMsg = "Please enter password again:"
            Call ShowLogon(sLoginMsg, sRegisterMsg)
        
          ' All register info received
          Else
      
            ' Open database connection
            Call DBOpen
        
            ' Successfully registered
            If UserSignUp Then
              Call GetRecord         ' Retrieve empty record
              Call ShowRecord        ' Show empty record in browser
          
            ' Dublicated UserName
            Else
              sRegisterMsg = "Please select other User name:"
              Call ShowLogon(sLoginMsg, sRegisterMsg)
            End If
        
            ' Close database connection
            Call DBClose
        
          End If
      
        ' Processing record change or others ---------------------
        ' need gsAction & gsPreAction as well as all other Form Data
        Case Else
    
          ' No changes are made by user
          If gsAction = "exit" And gsPreAction <> "change" Then
            SendHtmlFile "HtmFile6\DBThanks.html"
        
          ' User changed the record
          Else
      
            ' Open database connection
            Call DBOpen
        
            ' Confirm the changes
            If gsAction = "change" Then
              Call ShowRecord
          
            ' Save changed record
            ElseIf gsAction = "exit" And gsPreAction = "change" Then
              Call SaveRecord
              SendHtmlFile "HtmFile6\DBThanks.html"
            End If
        
            ' Colse database connection
            Call DBClose
        
          End If
      
      End Select

    End Sub

The lines of code in RED are only inserted to assign value to input variables for debug.

The survey.mdb should be in the same folder with AccessDB.vbp. click on How to Create for detailed instruction on creating survey.mdb.

To debug AccessDB, first toggle breakpoint on Select Case iTotalData, then run the program. After breakpoint, using F8 to step by step debug the program, just same as for normal VB program.

Good Luck!


For the latest information on WebRainbow, please see:
http://www.dmfsys.com/wrainbow/

For questions / comments please email to:
support@dmfsys.com


Copyright © 2000 - 2005 D.M.F. Systems, Corporation. All rights reserved.

Last modified on March 2, 2005