JDYoder Posted July 19, 2005 Posted July 19, 2005 I just read that Line Numbers can be used in VB.NET. I never even used them in VB6, but I'm curious if there's some advantage to using them, such as having the error message telling you the line # it crashed on, or something like that. Quote
Administrators PlausiblyDamp Posted July 19, 2005 Administrators Posted July 19, 2005 If you do a debug build then it tells you the line number as part of the exception anyway. You can get the IDE to display the line numbers from somewhere under tools - options if you want a more visual indication of them though. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
samsmithnz Posted July 19, 2005 Posted July 19, 2005 That's exactly it. You get an error and you can tell where it was raised. Quote Thanks Sam http://www.samsmith.co.nz
JDYoder Posted July 19, 2005 Author Posted July 19, 2005 Interesting. I didn't understand the point since I thought you'd have to type them in individually, which was hardly practical. (Though I see you can do that.) So if you don't specify any, it just defaults from line 1 to X behind the scenes? Then why would you type in your own? Quote
samsmithnz Posted July 19, 2005 Posted July 19, 2005 oh no, it's all automatic, tick the box in options and the line numbers appear. Quote Thanks Sam http://www.samsmith.co.nz
JDYoder Posted July 19, 2005 Author Posted July 19, 2005 Cool. But I see I can type in my own numbers, such as... 700: Messagebox.Show("HI") Which seems odd since the line number enabled after I check the option you mentioned doesn't change, but stays as it is. So what would be the point of someone doing the line I typed above? Quote
Diesel Posted July 19, 2005 Posted July 19, 2005 700 isn't a line number, you are naming a code access point. For example, you could also use: ShowTheMessageBox: Messagebox.Show("HI") And then you could use Goto ShowTheMessageBox 'or in your case Goto 700 and it would jump to that section. Before modular programming, this is how you could create functions Also, you would use the same format for error handling in Vb6- These days, if you are using unconditional jump statements in high level languages, you have problems Quote
JDYoder Posted July 19, 2005 Author Posted July 19, 2005 I see. I must have misread the MSDN. I understand what label statements are. I just thought if it was a number, it meant something else. My bad. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.