A
active
Function CastIt (byval z as boolean) As ??
if z then
CastIt = DirectCast(ActiveMdiChild, MyForm1)
else
CastIt = DirectCast(ActiveMdiChild, MyForm2)
end if
End Function
Can I make a function in VB that returns the result of a DirectCast.
I think what I don't know is what to use for ?? above.
Is it possible to do this in VB?
Thanks
PS
I'd use it like this
ZZ= CastIt.Getsomething
Where both MyForm1 and MyForm2 have the property Getsomething
I find it hard to believe the compiler would let me do that but maybe you
see a different approach.
I could do it without a function
if z then
qq = DirectCast(ActiveMdiChild, MyForm1).Getsomething
else
qq = DirectCast(ActiveMdiChild, MyForm2).Getsomthing
end if
But I need to do it many times
Thanks
if z then
CastIt = DirectCast(ActiveMdiChild, MyForm1)
else
CastIt = DirectCast(ActiveMdiChild, MyForm2)
end if
End Function
Can I make a function in VB that returns the result of a DirectCast.
I think what I don't know is what to use for ?? above.
Is it possible to do this in VB?
Thanks
PS
I'd use it like this
ZZ= CastIt.Getsomething
Where both MyForm1 and MyForm2 have the property Getsomething
I find it hard to believe the compiler would let me do that but maybe you
see a different approach.
I could do it without a function
if z then
qq = DirectCast(ActiveMdiChild, MyForm1).Getsomething
else
qq = DirectCast(ActiveMdiChild, MyForm2).Getsomthing
end if
But I need to do it many times
Thanks