Re: Classic VB6 conversion
Possibly this may have made more sense (to write less code):
Code:
With validScenario
if condition then
.MsgType = "blah"
else if condition2
.SomeProp = 1
else
...
end if
End with
Of course that thought is just based on the info provided, and as you alluded to, it's more complex than that :)
Re: Classic VB6 conversion
... and each time (both code versions) the same instance is being used, and that shouldn't be altered.
Re: Classic VB6 conversion
If that is the entire block of code, then I have to assume tScenario is a valuetype, because you don't ever actually call a New constructor to create an instance of it.
Regarding the With keyword, no new instance is created, it is from a compiler perspective the same thing as:
Code:
Dim validScenario as tScenario
if condition then
validScenario.MsgType = "blah"
else if condition2
validScenario.SomeProp = 1
else
...
end if
Re: Classic VB6 conversion
thanks all. much appreciated - i thought as much that it would be using the same instance.