Error Line number (Full Version)

All Forums >> [.NET Compact Framework Development] >> .NET Compact Framework - VB.NET



Message


ymahmood -> Error Line number (4/15/2008 5:56:41 AM)

Hi,

How can i get the line number for when an error occurs within a try catch?

TIA




petevick -> RE: Error Line number (4/15/2008 9:16:36 AM)

Add line numbers to your source and do...
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
1:      Dim a As Integer = 0
2:      Dim b As Integer = 123
3:      Try
4:          Dim c As Integer = b / a
5:      Catch ex As Exception
6:          MessageBox.Show("Line in error was " & Err.Erl)
7:      End Try
   End Sub


To turn line numbers on, do Tools | Options to display the Options window, and then selecting the Text Editor | Basic | General tab. Click on the Line Numbers check box, and VS .NET will display a margin that numbers every line in the file, including blank ones.

Alternately, you can use the excellent MZ-Tools (Which is what I did above) to selectively assign line numbers.

Pete




Page: [1]



Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode

0.000