30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix D <strong>Visual</strong> Studio .<strong>NET</strong> Debugger 1315<br />

30 Dim entry As CDebugEntry = New CDebugEntry()<br />

31 entry.DisplayValues()<br />

32 End Sub ' Main<br />

33<br />

34 End Class ' DebugEntry<br />

35<br />

36 ' demonstrates class debugging<br />

37 Public Class CDebugClass<br />

38<br />

39 ' declarations<br />

40 Private mSomeString As String<br />

41 Private mPrivateRef As Object<br />

42<br />

43 Public Sub New(ByVal stringData As String, _<br />

44 ByVal objectData As Object)<br />

45<br />

46 mSomeString = stringData<br />

47 mPrivateRef = objectData<br />

48<br />

49 End Sub ' New<br />

50<br />

51 Public Property SomeString() As String<br />

52<br />

53 Get<br />

54 Return SomeString<br />

55 End Get<br />

56<br />

57 Set(ByVal Value As String)<br />

58<br />

59 SomeString = Value<br />

60 End Set<br />

61<br />

62 End Property ' SomeString<br />

63<br />

64 End Class ' CDebugClass<br />

Fig. D.21 Debugging a class (part 2 of 2).<br />

Fig. D.22 Breakpoint location for class debugging.<br />

To assist class debugging, <strong>Visual</strong> Studio .<strong>NET</strong> allows the programmer <strong>to</strong> expand and<br />

view all data members and properties of a class, including Private members. In any of<br />

the four windows (i.e., Watch, Locals, Au<strong>to</strong>s and Me), a class that has data members is<br />

displayed with a plus (+) next <strong>to</strong> it (Fig. D.23). Clicking the plus box displays all of the<br />

object’s data members and their values. If a member references an object, the object’s data<br />

members also can be listed by clicking the object’s plus box.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!