 |
| VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1). |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 27th, 2004, 06:52 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Debugging with VB.NET
With VB6, you were able to break the program at any point, perform a "Step Into" to go into line-by-line debugging mode until another event fired, at which point you could step through each step of the code. Can anyone tell me how to do anything equivilant to this with VB.NET? Stepping into a "Break"'ed program does not seem to work even remotely the same way with vb.net..
Thanks for any help!
|
|

January 27th, 2004, 11:57 PM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm not too familiar with vb6 and "Step Into", but with vb.net you use "Breakpoints" to debug a section of code.
|
|

January 28th, 2004, 02:17 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That was possible with VB6 as well... The method I'm talking about seemed to treat each line of executable code as having a breakpoint during each "step into" the code.
|
|

January 28th, 2004, 04:41 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
It is still called Step Into in VB .NET.
Set a breakpoint somewhere, press F5 to start your application and wait until it hits the breakpoint. Then use F11 (Step Into) to step through your code line by line.
Is this what you meant?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 28th, 2004, 05:11 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes & No.. Here's an example of what I'm referring to:
2 buttons on a form, with the following code:
Private Sub Button1_Click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button1.Click
' Breakpoint on the next Messagebox.Show("")
Messagebox.Show("")
End Sub
Private Sub Button2_Click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button2.Click
' NO Breakpoint on the next Messagebox.Show("")
Messagebox.Show("")
End Sub
==========
Click Button1 -- You break into the code and start debugging.
Hit F11 to step into -- The messagebox appears
Hit F11 to step into -- You debug the "End Sub" line
Click Button2 -- No debugging of this sub happens.
In VB6, you would still be debugging whatever event fired after you "Step Into" past the "End Sub" line of Sub Button1 ...
|
|

January 28th, 2004, 05:49 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right, I see what you mean now.
In that case, I am afraid I don't know the answer.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 28th, 2004, 10:58 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
I have never had a problem stepping through a program in .NET- However, you can't debug while stepping through in .NET- you need to edit and restart in most cases.
Hal Levy
Web Developer, PDI Inc.
NOT a Wiley/Wrox Employee
|
|

January 28th, 2004, 11:55 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
nhdw-
The code you provided shows two different events. I think there is a problem (maybe it's a feature) in VS.net that doesn't allow you to "step into" the very beginning of an execution (like you could in older VB applications). This is what I have found in ASP.net at least. Haven't done a whole lot of debugging in non ASP.net VB.net. As Imar has suggested, you have to set a breakpoint at the point of interest, and only from that point forward can you step thru all parts of the execution. And even this is problematic. In ASP.net I have seen cases where I have put a break on the Page_Load function, but NOT on some event that I expect to fire after that. The debugger hit the Page_Load breakpoint, then I step thru all of that method. After "End Function" for Page_Load, "Step Into..." essentially becomes "Go". Unless you have another breakpoint on the other parts of your code (i.e. in the events), you are off and running without debugs stops. I think you'll need to put another breakpoint in the applicable event.
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

February 1st, 2004, 06:26 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Peter ... re: After "End Function" for Page_Load, "Step Into..." essentially becomes "Go".... That seems exactly like what's happening... It's a shame... the "Ongoing debug" while stepping into the code with VB6 was extremely useful & much simpler than setting multiple breakpoints throughout the program... Oh well :) If it IS a bug, hopefully it's fixed soon, but I'm not sure how many people use this kind of debugging...
|
|
 |