Advertisement
2002ASP Debugging and Error Handling #2142

Add Debug.Print to your app easy

The Debug.Print is most important as long as your program runs! If there is something wrong, error/problem, the user can always report to you what he did, by showing you the debugtext. BUT when it's compiled the user of your app. can't see the Debug.Print window!!! The thing I add (always) into my program is showed beneeth here following (simple but efficient):

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
1. make a Form called frmDebug
2. add a textbox called txtDebug (multiline+scrollbar(s))
3. Add a Module and Copy this into the module:

Option Explicit
Public ShowDebugWindow As Boolean

Public Function DebugPrint(DebugStr As String)
 If ShowDebugWindow = True Then
   frmDebug.Show
   frmDebug.txtDebug = frmDebug.txtDebug & vbCrLf & "[" & Time & "] " & DebugStr
 Else
   frmDebug.Hide
 End If
End Function



For those who read this but don't understand what to do exactly: 
1. Add a Form to the project (Form1)
2. Add a button into Form1
3. (Click) Code for the button is:

Private Sub Command1_Click()
  ShowDebugWindow = True
  DebugPrint "Button clicked!"
End Sub

when you run yer program (startup object is Form1) press the button and the DebugWindow will popup!

Good Luck!
http://start.at/iseekyou
Původní komentáře (3)
Obnoveno z Wayback Machine