You can't comment a line during run time. You are speaking of conditions, well, as Eri523 said, you need to use an If Statement. Otherwise you should look into debugging which provides tools such as Step Over (which skips some lines of code ) and Step Into ( which goes to the next line(s) ).
If you provide more details on what you want to achieve, we coulkd help better
Is there a way one can comment on a line of code at runtime. I want the line to be skipped at some at some points in the program, when certain conditions are met.
I'm sure you comment a line so as to skip it if certain conditions aren't met but thats what If Then is for.
You could put a BreakPoint in the code so when your apps gets to that line of code it will stop. You can look at the code window and move through the code by pressing the F8 button that will slip through a line at a time. You can look at the code window and hold your mouse over any variable and if will show its value.
I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
No you can not comment a line of code at runtime, and no you can not make a comment do anything other than display a comment in the editor. Comments are completely ignored at run time and do not exist in the exe.
As stated by others this is what the If Then is for.
Comments are simply used to make the code easier to understand.
And if you actually meant to say Comment out a line at runtime then no you can not do that either.
Last edited by DataMiser; June 27th, 2012 at 11:29 AM.
I figured out what you were referring to after I posted, I just did not think that is what the OP was referring to. Seems like the intent was to either add a comment to the code at runtime or more likely change a line of code into a comment so it does not execute neither of which are possible.
As others had said it appears that what is need is a IF Then block