Reputation: 6280
(New clsViewIllus).View(MyIBaseView, enumViewSolveTypes.View, Me, , True)
... in VB? Basically too lazy to do this:
Dim vi As New clsViewIllus
vi.View(MyIBaseView, enumViewSolveTypes.View, Me, , True)
Upvotes: 3
Views: 664
Reputation: 351
I know the post is back in 2011, but a helpful tip for those who come across this post...
You can also use the Call statement, such as:
Call New clsViewIllus.View(MyIBaseView, enumViewSolveTypes.View, Me, , True)
You can even set properties along the way...
Call New clsViewIllus With {.Prop1 = value}.View(MyIBaseView, enumViewSolveTypes.View, Me, , True)
Upvotes: 3
Reputation: 18215
Hack Version
CType(New clsViewIllus(), clsViewIllus).View(MyIBaseView,....)
Upvotes: 0
Reputation: 6280
As far as I've found, with vs2008, It can't be done, unless you do something with the return value, e.g.,:
Process.Start(New ProcessStartInfo("c:\temp\out.bmp") With {.UseShellExecute = True})
but my .View above is a sub so I couldn't even assign it to a dummy object. Makes sense that you can do this in c#.
Upvotes: 0
Reputation: 19871
clsViewIllus
should be a shared class. You mentioned in comments that the class has other uses and ways to use the methods. But do those other uses stay in context with the method you have defined?
If not, then you need to write another class.
Now, to your question:
Why can't I:
(New clsViewIllus).View(MyIBaseView, enumViewSolveTypes.View, Me, , True)
Edit
Basically, it isn't allowed from what I can tell. If I can find something in the language specification, I will update. But the compiler pretty much tells you why this can't be done:
I made a mistake on my side:
I believe you can. I did it in C#. What you may be missing is the parentheses. Try this:
(New clsViewIllus()).View(MyIBaseView, enumViewSolveTypes.View, Me, , True)
Although, IMHO, it is bad form and screams for Module
or Shared
.
Upvotes: 1