Whats the default value for a string()

  • Thread starter Thread starter David Lozzi
  • Start date Start date
D

David Lozzi

OK simple question. Whats the default value for an string() array?

sub LoadStuff(byval one as integer, byval two as string, optional byval
three() as string = ??)

Its driving me nuts!

Thanks!
 
Hi,
sub LoadStuff(byval one as integer, byval two as string,
optional byval
three() as string = ??)

It has to be Nothing, because it has to be a constant value.

Mit freundlichen Gruessen / Best regards,

--
Karsten Samaschke
IT-Consulting, IT-Development, IT-Training
5x MS MVP ASP / ASP.NET, Germany
Homepage: http://www.ksamaschke.de
Weblog: http://www.karsan.de
- - - - - - - - - - - - - - - - - - - - - - - - - -
My Weblog: http://www.karsan.de
My Books: http://books.ksamaschke.de
 
Thanks for Karsten's inputs.

Hi David,

As for the string() , it is actually an Array type which is a reference
type. So when we use reference type as optional parameter in VB.NET
function, we have to assign Nothing as its default value (since there is no
static expression which can represent an instance of a reference type....)

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Message-ID: <[email protected]>
| From: "Karsten Samaschke [MVP]" <[email protected]>
| References: <[email protected]>
| Subject: Re: Whats the default value for a string()
| Date: Thu, 17 Nov 2005 09:46:31 +0100
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| X-Mailer: Microsoft Office Outlook, Build 11.0.6353
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| In-Reply-To: <[email protected]>
| thread-index: AcXrUWadNgQNceNjTjq0ZgjptJbulAAAXijQ
| X-Transport: MAPILab NNTP v1.3 for Microsoft Outlook,
http://www.mapilab.com/
| User-Agent: Hamster-Pg/1.21
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: webbox301.server-home.net 195.137.213.62
| Lines: 1
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:358835
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi,
|
| > sub LoadStuff(byval one as integer, byval two as string,
| > optional byval
| > three() as string = ??)
|
| It has to be Nothing, because it has to be a constant value.
|
| Mit freundlichen Gruessen / Best regards,
|
| --
| Karsten Samaschke
| IT-Consulting, IT-Development, IT-Training
| 5x MS MVP ASP / ASP.NET, Germany
| Homepage: http://www.ksamaschke.de
| Weblog: http://www.karsan.de
| - - - - - - - - - - - - - - - - - - - - - - - - - -
| My Weblog: http://www.karsan.de
| My Books: http://books.ksamaschke.de
|
|
 
You're welcome David,

Good luck!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| From: "David Lozzi" <[email protected]>
| References: <[email protected]>
<[email protected]> <[email protected]>
| Subject: Re: Whats the default value for a string()
| Date: Thu, 17 Nov 2005 11:51:09 -0500
| Lines: 79
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:358963
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Excellent, thank you both!
|
| --
| David Lozzi
| Web Applications Developer
| dlozzi@(remove-this)delphi-ts.com
|
|
|
| | > Thanks for Karsten's inputs.
| >
| > Hi David,
| >
| > As for the string() , it is actually an Array type which is a reference
| > type. So when we use reference type as optional parameter in VB.NET
| > function, we have to assign Nothing as its default value (since there
is
| > no
| > static expression which can represent an instance of a reference
type....)
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| > --------------------
| > | Message-ID: <[email protected]>
| > | From: "Karsten Samaschke [MVP]" <[email protected]>
| > | References: <[email protected]>
| > | Subject: Re: Whats the default value for a string()
| > | Date: Thu, 17 Nov 2005 09:46:31 +0100
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="us-ascii"
| > | Content-Transfer-Encoding: 7bit
| > | X-Mailer: Microsoft Office Outlook, Build 11.0.6353
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | In-Reply-To: <[email protected]>
| > | thread-index: AcXrUWadNgQNceNjTjq0ZgjptJbulAAAXijQ
| > | X-Transport: MAPILab NNTP v1.3 for Microsoft Outlook,
| > http://www.mapilab.com/
| > | User-Agent: Hamster-Pg/1.21
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: webbox301.server-home.net 195.137.213.62
| > | Lines: 1
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:358835
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Hi,
| > |
| > | > sub LoadStuff(byval one as integer, byval two as string,
| > | > optional byval
| > | > three() as string = ??)
| > |
| > | It has to be Nothing, because it has to be a constant value.
| > |
| > | Mit freundlichen Gruessen / Best regards,
| > |
| > | --
| > | Karsten Samaschke
| > | IT-Consulting, IT-Development, IT-Training
| > | 5x MS MVP ASP / ASP.NET, Germany
| > | Homepage: http://www.ksamaschke.de
| > | Weblog: http://www.karsan.de
| > | - - - - - - - - - - - - - - - - - - - - - - - - - -
| > | My Weblog: http://www.karsan.de
| > | My Books: http://books.ksamaschke.de
| > |
| > |
| >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top