Skip to main content

Error Line number

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [.NET Compact Framework Development] >> .NET Compact Framework - VB.NET >> Error Line number Page: [1]
Login
Message << Older Topic   Newer Topic >>
Error Line number - 4/15/2008 5:56:41 AM   
ymahmood


Posts: 218
Score: 0
Joined: 8/13/2002
From: Birmingham - UK
Status: offline
Hi,

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

TIA
Post #: 1
RE: Error Line number - 4/15/2008 9:16:36 AM   
petevick


Posts: 3320
Score: 0
Joined: 4/26/2002
From: Bolton - UK
Status: offline
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

_____________________________

Pete Vickers - Microsoft MVP - Device Application Development
www.gui-innovations.com

Please do not email me with questions. Posting your questions in the forums will get a quicker response - Thanks.

(in reply to ymahmood)
Post #: 2
Page:   [1]
All Forums >> [.NET Compact Framework Development] >> .NET Compact Framework - VB.NET >> Error Line number Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode

0.016