By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

Operator precedance

P: n/a
Dear All,

I am wondering that followind produces an exception if Startline is
Nothzing.

In C++ is first operation is true it would be enougth for the or statement
to be true.

If elem.StartLine Is Nothing Or elem.StartLine.ParentLine Is Nothing Then
....

Is there some setting to eleminate it?

Thanks,

Boni
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Boni" <oilia@nospam> schrieb:
I am wondering that followind produces an exception if Startline is
Nothzing.

In C++ is first operation is true it would be enougth for the or statement
to be true.

If elem.StartLine Is Nothing Or elem.StartLine.ParentLine Is Nothing Then


Take a look at the documentation for the 'Or' and 'OrElse' operator.
'OrElse' will perform short-circuiting.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a
Boni,

That is the same in VBNet, however in VB they both are evaluated when it is
the Or.

To avoid that is created the operator OrElse. That acts as in every other
program language the Or.

I hope this helps,

Cor
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.