Board index » Visual Studio » How make Guid parameter optional in function?
|
mikeyts
|
|
mikeyts
|
How make Guid parameter optional in function?
Visual Studio336
I have a function in which I'm trying to make the parameter optional. However, when I put Optional in front of ByVal below I get the error "optional parameters cannot have structure types". Public Function SelectPenType(ByVal PenTypeID As Guid) As DataSet Implements IPen.SelectPenType Any idea how I should be doing this? Thanks, Ron - |
| Spam
Registered User |
Thu May 24 16:56:09 CDT 2007
Re:How make Guid parameter optional in function?
"Ronald S. Cook" <rcook@westinis.com>wrote in
QuoteI have a function in which I'm trying to make the parameter optional. I would create an overloaded version of the function. i.e. Public Function SelectPenType() As DataSet Implements IPen.SelectPenType SelectPenType(Nothing) End Fucntion Also take a look at the Nullable types or you can njust pass in a fixed value, i.e. GUID.empty to represent no parameter. - |
| DavidAnton
Registered User |
Thu May 24 19:29:00 CDT 2007
Re:How make Guid parameter optional in function?
That's a very confusing error message. There is no problem having optional
parameter types for most structure types, so the message should have indicated why "Guid" was treated differently than other structure types such as double, DateTime, decimal, etc. -- David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter C++ to C# Converter: converts C++ to C# Instant C++: converts C# or VB to C++/CLI "Ronald S. Cook" wrote: QuoteI have a function in which I'm trying to make the parameter optional. |
| Spam
Registered User |
Thu May 24 20:32:10 CDT 2007
Re:How make Guid parameter optional in function?
=?Utf-8?B?RGF2aWQgQW50b24=?= <DavidAnton@discussions.microsoft.com>
wrote in news:B7CF5AE5-EC3A-4336-8652-BC9528158FE1@microsoft.com: Quoteso the message should have base type. - |
