For the most part, my posts are written in C#. Of the NetCF supported languages, C# is where I am most comfortable. Every once in awhile, however, I'll post a VB.Net related topic (this is my second). Today I thought I'd show a NetCF application written in VB.Net running under cordbg.
Debugging VB.Net applications under cordbg works the same way as debugging C# applications. Once you connect, you can view source, step, set breakpoints, etc.
Below is a brief source display of the Scribbler sample application from Visual Studio .NET 2003 (Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\Samples\VB\Pocket PC\Scribbler), after hitting a breakpoint in the bClear_Click method.
(cordbg) sh 10
149: End Sub
151: Public Shared Sub Main()
152: Application.Run(New ScribblerForm())
153: End Sub
155: #End Region
157: Private Sub bClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bClear.Click
158:* Me.graphics.FillRectangle(New SolidBrush(Color.White), 0, 0, Me.pDrawWindow.Size.Width, Me.pDrawWindow.Size.Height)
160: End Sub
162: Private Sub pDrawWindow_Paint(ByVal sender As System.Object, ByVal e As PaintEventArgs) Handles pDrawWindow.Paint
163: e.Graphics.DrawImage(Me.bitmap, 0, 0)
164: End Sub
166: Private Sub pDrawWindow_MouseDown(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles pDrawWindow.MouseDown
167: Me.hasCapture = True
168: Me.oldX = e.X
(cordbg) sh 10
One thing to be aware of when debugging VB.Net code in cordbg: there is no concept of "Me". The example below shows the variables that are in scope in the source display above (inside of bClear_Click).
As you can see, there is no "Me" variable in the above list. Instead, you get the C++/C# equivalent: "this". In other words: "this" == "Me". Sorry for the C/C++/C# style == operator in a VB.Net post, but I couldn't help myself. 😉
Until next time,
This posting is provided "AS IS" with no warranties, and confers no rights.