VB.NET With statement

0.00 avg. rating (0% score) - 0 votes

The following code will run flawlessly but at the end, Obj will still contain the assigned properties (.prop1 = 0 and .prop2 = “hello”) and is not a new instance of ObjType. The attempt to assign a new instance of ObjType to obj has no effect as the reference to obj will be reverted to the original value when the code gets out of the With block.

With Obj
.prop1 = 0
.prop2 = “hello”

obj = new ObjType()
End With

0.00 avg. rating (0% score) - 0 votes


A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>