473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Calling one constructor from the other

With C# I am able to do something like that:

public ClassName() {some code here}
public ClassName(Parameters here):this() {some code here}

and when calling the parameters constructor it calls the default
constructor first and than continue to the parameter constructor code.

Is it possible to do the same thing with vb.net ??

Nov 21 '05 #1
2 1076
"Shlomy Shivek" <sh**********@gmail.com> schrieb:
public ClassName() {some code here}
public ClassName(Parameters here):this() {some code here}

and when calling the parameters constructor it calls the default
constructor first and than continue to the parameter constructor code.

Is it possible to do the same thing with vb.net ??


\\\
Public Sub New()
...
End Sub

Public Sub New(...)
Me.New()
...
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
Dan
In VB.NET you would do the following

Public Sub New()
'Some Code Here
End Sub

Public Sub New(ByVal parameters)
Me.New() 'Invokes The Default Constructor
'Some Code Here
End Sub
Hope That Helps.

Dan

"Shlomy Shivek" wrote:
With C# I am able to do something like that:

public ClassName() {some code here}
public ClassName(Parameters here):this() {some code here}

and when calling the parameters constructor it calls the default
constructor first and than continue to the parameter constructor code.

Is it possible to do the same thing with vb.net ??

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Murat Tasan | last post by:
i have a quick question... is there a way to obtain the reference to the object which called the currently executing method? here is the scenario, i have a class and a field which i would like to...
9
by: Giulio | last post by:
why definition of two constructors like these is not possible in c++??? ----------------------- date::date(const int d, const int m, const int y, const int ora, const int mi, const int se){...
4
by: Jerry Krinock | last post by:
I've written the following demo to help me understand a problem I'm having in a larger program. The "main" function constructs a Foo object, and then later "reconstructs" it by calling the...
6
by: Justin | last post by:
Hello, first time posting. If I have a base class and a derived class, is there only one way to call the base constructor? i.e. Is this the only way I can call the base constructor...
8
by: Greg Bacchus | last post by:
I have a base class with a method that is to be called in the constructor of the inheritting classes. Is there any way of determining, say, the Type of the class that is calling it. e.g. ...
0
by: Brent Baker | last post by:
In our application we've created some temporary dialog boxes. Rather than the usual method of 1) calling the constructor for the dialog, 2) doing other initialization 3) calling DoModal() 4)...
12
by: st_ev_fe | last post by:
I've noticed that when constructing a subclass, the base class get's it's contructors called. Is there some way to avoid this? The base class has one variable, which gets initialised to 0. ...
6
by: daveb | last post by:
I'm trying to write some code that calls the constructors of STL containers explicitly, and I can't get it to compile. A sample program is below. One compiler complains about the last two lines...
4
by: ali | last post by:
Hi, I am new to C++ and trying to understand how to work on Inheritance and Operator overloading. I understand that the derived class can pass the base class constructor in its constructor...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.