"Tushar Mehta" wrote...
When I want to point out to a regular poster, especially one who is
more often right than wrong, . . .
I could be really snotty and ask who that might be, but I admit I screwed up
by not reading the preceding branch.
I'd bet default properties were only available on the right hand side of
assignments in
VB.NET. In VBA, if the code were
Dim x As Object
Set x = Range("A1")
x = Range("A2")
the second [Let] assignment statement is equivalent to
x.Value = Range("A2").Value
In
VB.NET, the closest code would be
Dim x As Object
x = Range("A1")
x = Range("A2")
which would be the same as the VBA code
Dim x As Object
Set x = Range("A1")
Set x = Range("A2")
To do the same thing as the first VBA code above, the tersest
VB.NET code
would have to be
Dim x As Object
x = Range("A1")
x.Value = Range("A2")
Right hand side default properties are up to the object itself to provide.
Left hand side default properties require assistance from the parser.
Without the Set keyword, there's no way to do it without imposing a level of
type awareness that's never been part of any Microsoft BASIC dialect. In C++
and Java, there can be class member functions that return different things
depending on the type of the variable to which the object variable is
assigned. VBA doesn't support this, but it'd be nice if
VB.NET did (and if
VB.NET doesn't provide the Variant type, there's no reason it couldn't).