snapper0042 snapper0042 - 11 months ago 46 Question

Comment out inline if statement in VB?

I am having problems trying to comment out an inline if statement in VB. Is this even possible? This syntax does not seem to be recognized in Visual Studio.

'IIf(BusinessFactor <> 1, " x Business Factor " & BusinessFactor& " = $" & brPremium & " (rounded)", "") & _



Your inline If-statement has a line continuation character (which is the underscore _) after it, which means that the whole statement continues on the next line.

You would need to put that continuation char before the comment, but as that is not possible (due to that the continuation character must be the last on that line) your only option is to (re)move the entire If.

In cases where you don't have a continuation character, commenting it out will work just fine.