![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: asp, exit, help, sub, vbscript |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |
| The Following User Says Thank You to Lee For This Useful Post: | ||
TeraTask (12-24-2007) | ||
| |||
| Also works for other loops - like if you wanted to be optimized you could do Code: For Each DR as DataRow in DataTable
If DR.ProductID = 34
MsgBox(DR.ProductName)
Exit For
End If
Next ![]() __________________ Day Cares | Golf Courses | Disc Golf Courses | Campgrounds | Ice Rinks | Paintball Fields | Dentists | Plastic Surgeons | Aging Jokes Catholic Churches | Lutheran Churches | Methodist Churches | Episcopal Churches | Clean Jokes Last edited by TeraTask : 12-24-2007 at 06:45 PM. Reason: Added code tags |
| ||||
| so it's kind of break; statement in the loop..? but this one is for a method..? Hey, Sub madeup() isn't a method isn't it? what is it then..? The way we call sub is different than calling a method..? or is it just the same thing? if it's the same, then what's the difference..? XD sorry, tons of question.. lol.. this scripting language is kind of weird to me at first |
| ||||
| i used the sub made up as an example, to run the sub you may put "madeup()" inside a buttons sub and it will run the madeup sub...i would say it is like break yes... not sure what you mean for the rest. |
| |||
| A "method" is simply a sub or function that is part of a class or an object. in the same way that a property is simply a variable that is encapsulated in a class. __________________ Chris Indifference will be the downfall of mankind, but who cares? Code Samples | People Counting System |
| The Following User Says Thank You to chrishirst For This Useful Post: | ||
TeraTask (12-24-2007) | ||
| |||
| yes, exit [for, sub, etc...] is like break; - it exits out of the local loop ![]() __________________ Day Cares | Golf Courses | Disc Golf Courses | Campgrounds | Ice Rinks | Paintball Fields | Dentists | Plastic Surgeons | Aging Jokes Catholic Churches | Lutheran Churches | Methodist Churches | Episcopal Churches | Clean Jokes |
| |||
| This is my first time posting, happened across the boards when searching for something else. So Hello All! ![]() Anyways, one thing that I find most useful especially when using Exit Sub is that if you have it within a Try...Catch...Finally statement, whatever is in the Finally part of the block will happen regardless of anything else. So, if you wanted to dispose of objects, disconnect from data sources, reset buttons, etc. before you exit the sub/function then you can put this all in the finally block and make sure it is done. However with exit do, while, for - unless the try...catch..finally block is encapsulated within them, the finally will not be triggered right away, it will complete whatever code is beyond them then once it either finishes with the sub/function or hits the exit sub/function command. This can also be a deficit for the exact same reason, so be sure of what you put in there!! Good Luck and Happy Coding!! D Last edited by dminder : 04-24-2008 at 09:50 AM. |
| |||
| Just to keep you in th eloop thats for .NET+ - classic ASP/VBScript doesn't have a try catch __________________ Day Cares | Golf Courses | Disc Golf Courses | Campgrounds | Ice Rinks | Paintball Fields | Dentists | Plastic Surgeons | Aging Jokes Catholic Churches | Lutheran Churches | Methodist Churches | Episcopal Churches | Clean Jokes |
![]() |
| Thread Tools | |
| Display Modes | |
| |