Вы находитесь на странице: 1из 5

Visual Basic 1 Page :t n:v

nxxw s: ) Debugging (

n:xo x:v
: . ann ) Syntax (
z . nx ) Run-time (
1 . n:x:> ) Logic (

n:x:> n:xoa >:oo

n :u u:5n :xu - debugger

:

n>aon nrvn rro (:rn nn:;: MSDN
Debugging tool Purpose
Start Runs the application
Break Stops execution of a program temporarily
End Stops running the program and returns to Design mode
Breakpoint Defines a line in the Code window where Visual Basic
automatically halts execution and enters Break mode.
Step Into Executes the next executable line of code in the application and
steps into procedures.
Step Over Executes the next executable line of code in the application
without stepping into procedures.
Visual Basic 2 Page :t n:v
Step Out Executes the remainder of the current procedure and breaks at the
next line in the calling procedure.
Locals Window Displays the current value of local variables.
Immediate Window Allows you to execute code or query values while the application
is in break mode.
Watch window Displays the values of selected expressions.
Quick Watch Lists the current value of an expression while the application is in
break mode.
Call Stack While in break mode, presents a dialog box that shows all
procedures that have been called but not yet run to completion.


nsv ~p: ; Break Points (

v nsv ~p: 5un a5vn :u :cun upcn :v nsn: , :cuc ~pn u: .
ns ,c\a , nsv u u na ~pn u: :5n vx u5 , :5n c~pn sv , n5
vs ~pn vsaa u~pn: ucn: u5n :: ,: ~pn ,:n upc vsca ~vs n ~ F8 ;
Step Into .(


~vs n ~vs :5n sn , vsca Step Into ; F8 (

ans vpa ,cu vsa :5: nu :5 . :v 5u: nsn: F8 , nan n~p5: :5n u~p
vsa: .
:5a n nxu: np u u , v Step Into uu p:n nxu: av: :5 :v av:
~vs n ~vs na nn , n5:n nxua vsa: nan nn: \n:u :5: .


vsca :5n sn Step Over ; Shift+F8 (
:5a n nxu: np u u , v Step Over _ p:n nxun , >au :5 :v av:u
~vs n ~vs na nn , an nn: \n: n5:n nxua vsa: n .
Visual Basic 3 Page :t n:v


vsca :5n sn Step Out ; Ctrl+Shift+F8 (
v Step Out , n5u ~v nxun _ , nan nxun vsau5 sv vsan


a ucu - Watch Window
no: : ns: ::: ;:n c:n:: c::nc: ::v: ::::c: ;:::nn:


: u:uca ,:an: u5~ .

ntvn nov |:nu nn:> n>aon MSDN :
Watch Type Description
Watch Expression

watch the expression and display its value in the Watch
window at any time the application enters Break mode.
Break When Value is True

break execution any time the value of the expression
evaluates to a True (nonzero) statement.
Break When Value Changes

enter Break mode when the value of the expression
changes










Visual Basic 4 Page :t n:v
nx ;ut n:xoa >:oo ) runtime errors (

ns ,c\a xua :5o: ,:x:c ; run time error handeling ( v :v5c .
Err ucucn ~p: 5vcn ,a nxun :: avn: u5cu nxun opa .

ERR oa:
ou u:5c u opa: .
Err.Number ,5c , cu: nxun 5uc
Err.description ,5c , nxun cu:
Err.Clear nou , :n: ; u5 ( opan

xu: ~5:c n:n: ~5 s o5ucn asn: On error n::vn ~pn u :5:
va n: . : nc n\ o5uc - VB ,: nxua :p: n u5 jvun:

ooou On Error ) n:xo n~a> (

an .
On Error GoTo label
n:xoa >:oo> >an oo :n . label

ooou resume nxun n:xn na nu: vsan \nc .
ooou Resume next nxun n:xn na nun :v x:~c , :5n vsa ucc .
xun cu sc: :5 a - .Help uun n Trappable Errors ***


Visual Basic 5 Page :t n:v
cx~ .

Private Sub Form_Activate()

On Error GoTo ErrorHandler ' Enable error-handling routine.
Image1.Picture = LoadPicture(App.Path & "/learning.gif")

Exit Sub ' Exit to avoid handler. a> :uo ::

ErrorHandler: ' Error-handling routine.
Select Case Err.Number ' Evaluate error number.
Case 53 ' "File not found" error.
MsgBox "picture file name is incorrect " & _
err.Description
Case Else
' Handle other situations here...
End Select

End Sub

: c:::c: n:x:::: - resume

errorhandler:
MsgBox Err.Description, vbCritical, "loadingPicture"
Err.Clear ' Clear Err object fields
Resume 'Goes back to the line which caused the error


errorhandler:
MsgBox Err.Description, vbCritical, " loadingPicture "
Err.Clear
Resume Next 'Goes to the line after the line which caused
the error


errorhandler:
MsgBox Err.Description, vbCritical, " loadingPicture "
Err.Clear
Resume (line label) 'Goes directly to a line label

Вам также может понравиться