all groups > vb.net upgrade > october 2007 >
You're in the

vb.net upgrade

group:

Optional Parameter...


Optional Parameter... Sriman
10/29/2007 3:01:01 PM
vb.net upgrade:
We are migrating the vb6 projects(few components, rest in vb6 only) to C#.Net
2005.
In this migration process we are facing one big issue with optional
parameter. Actually in C#.Net there is not optional parameter concept . For
that C# introduced 2 concepts like 1)overloading 2)params .
But problem is
1) I am not able to see access 0these overloading methods in vb6(for eg:
NewUser(string a), NewUser(string a, string b)). In vb6 its showing the
method name like(NewUser and NewUser_1)
2)If i use Params string[] concept: Not able to access/ see this in vb6.
giving error like vb6 doesn't support this method.

I Would appreciate if any one helps in solving this issue.

Regards,
Re: Optional Parameter... Jan Hyde (VB MVP)
10/30/2007 12:00:00 AM
Sriman <Sriman@discussions.microsoft.com>'s wild thoughts
were released on Mon, 29 Oct 2007 15:01:01 -0700 bearing the
following fruit:

[quoted text, click to view]

That's correct because VB6 doesn't understand overloading
methods.

[quoted text, click to view]

I'm not really sure what your issue is.

Is it just that you want to call a dotnet function from VB6
and you want an optional argument?




--
Jan Hyde

Re: Optional Parameter... Sriman
10/30/2007 5:28:33 AM
Thanks for the replay.
Yes, I want to call C#.Net functions(Overloaded methods) from vb6 components.

Thanks in advance
Regards,
Sriman

[quoted text, click to view]
Re: Optional Parameter... Jan Hyde (VB MVP)
11/1/2007 1:09:53 PM
Sriman <Sriman@discussions.microsoft.com>'s wild thoughts
were released on Tue, 30 Oct 2007 05:28:33 -0700 bearing the
following fruit:

[quoted text, click to view]

VB6 is not going to be able to cope with overloaded methods
so you will either have to live with VB6 treating them as
seperate methods or change your .Net code to no longer use
overloaded methods. Neither of which really help you with
your desire for optional parameters.

I would probably just have my VB6 program pass all
parameters (passing empty string etc as needed for the
optional items) and have my .Net code cater for this.

J

[quoted text, click to view]

--
Jan Hyde

AddThis Social Bookmark Button