Apparently, this does not work.
WHY ???????
I don't want to do all this just to call my function:
Dim x as new Object()
x.Method()
Why do I have to do this in two lines when I can in one.
In VB.NET, when we pass one or more arguments to a constructor, the constructor is known as a parameterized constructor. And the object of the class should be initialized with arguments when it is created. Let's create a program to use the parameterized constructor to pass the argument in a class.
Instantiation: The new keyword is a Java operator that creates the object. As discussed below, this is also known as instantiating a class.
Objects can be initialized using new Object() , Object. create() , or using the literal notation (initializer notation). An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ( {} ).
You need to add the Call keyword.
Call New Page().DataBind()
This causes the object to be created before passing to the Call statement.
Yes, I agree, (New Object()).Method()
seems more intuitive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With