While the purpose of this Community is not to describe all of Visual Studios features, or even promote it, this provides some additional foundation to those who are just starting out. We will be using the code out of Your First COM application, and expand it slightly in the process. I will include the code here for convenience:
Module Module1
Sub Main()
Dim vcApp As vcCOM.IvcApplication
vcApp = New vc3DCreate.vcc3DCreate
For i = 0 To vcApp.ComponentCount - 1
System.Console.Out.WriteLine(vcApp.getComponent(i).getProperty("Name"))
Next
End Sub
End Module
The purpose
of debugging is to find flaws in your code. While the computer can't know your
intention it can help you understand your code. Breakpoints provide the basis
for this functionality. Placing breakpoints happens by going to line of code
and pressing F9, clicking on the code window at the leftmost point or form the
Debug menu. Once the code is executed it stops at the breakpoint and you can
resume by pressing F5. While your code is stopped you can hover your mouse over
variables and the programming environment will show you their values as set at
that point in code. This gives you some valuable insight on what the code is
doing. Further you can choose F8 (may differ from visual studio version check
in the debug menu) to step to the next line of code and go through the program
line by line.
If you now place the breakpoint on the line with Sub Main() and execute by pressing F5. the code soon halts, you can now press f8 to go to next line, press till you hit the syste.Console line a second time. The yellow line is whats going to be executed next. Notice how the code jumps back, it shows you the loop like it executes you can hover over i to see that its value is now 1. One of the great features of .NET execution environment is that you can edit code while running it. Lets move the system console line down one step and insert:
System.Console.Write(i + " ")
Notice how the yellow line followed it think you changed code before execution of it. Now all you need is to drag the arrow up one line to say nbo i mean you to rin this line. Step forward and note how the ditor now prints a error. Well we have slight glitch you cant actually add a number and a string, but you can add 2 strings, and yu can convert a nober to s astring so lets edit it to read:
System.Console.Write(i.ToString + " ")
lets try again, F8 yields print in he console, step forward till program ends and note thet the outut is different.it now counts numbers in fornt of names. Clear all breakpoints and insert on at the end sub. Then re-run, note how the count starts at 0, very geeky. Lets change the line one more time:
System.Console.Write((i+1).ToString + " ")
And now it prints numbers like a human would count. While this wasnt very fundamentally usefull, i hope you learnt the benefits of a good programming environment. So you can go forward.