Stepping through Code

The modern debuggers (normally integrated with the IDE) are much better than this. As you will see shortly, they will allow you to step through your program (execute one statement at a time) and look at the values of variables. Also the debugger will allow you to set breakpoints, which are statements in your programs that you mark and tell the debugger to suspend program execution when it gets there, so that you can have a look at what is happening. Let's try an example. Create a new console project and enter the code as shown:

 Module Module1 Sub Main() Dim a() As Integer = {1, 6, 6, 9} Dim s As String = "The array has " s += CStr(Count6es(a)) s += " elements that have a value of 6" Console.Out.WriteLine(s) End Sub ' This ...

Get Visual Basic® .NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.