PC Review


Reply
Thread Tools Rate Thread

Basic Syntax question -- Sorry :-$

 
 
al
Guest
Posts: n/a
 
      3rd Oct 2003
I'm teaching myself VB.Net from books, and have come
across the use of square brackets a couple of times in the
code samples. But I can't find any reference as to why or
what they are for.

Thanks in advance


E.G.
Public Class ChatClient
Inherits MarshalByRefObject


Public Sub New(ByVal [alias] As String)
Me.username = [alias]
End Sub
....
End Class


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Oct 2003
"al" <(E-Mail Removed)> scripsit:
> I'm teaching myself VB.Net from books, and have come
> across the use of square brackets a couple of times in the
> code samples. But I can't find any reference as to why or
> what they are for.


<http://msdn.microsoft.com/library/en-us/vbls7/html/vblrfVBSpec2_2.asp>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
EricJ
Guest
Posts: n/a
 
      3rd Oct 2003
in other words you can replace [this] w a name you choose (normally a name
of a variable)


"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:bljdqb$cr6vm$(E-Mail Removed)...
> "al" <(E-Mail Removed)> scripsit:
> > I'm teaching myself VB.Net from books, and have come
> > across the use of square brackets a couple of times in the
> > code samples. But I can't find any reference as to why or
> > what they are for.

>
> <http://msdn.microsoft.com/library/en-us/vbls7/html/vblrfVBSpec2_2.asp>
>
> --
> Herfried K. Wagner
> MVP · VB Classic, VB.NET
> <http://www.mvps.org/dotnet>



 
Reply With Quote
 
Karen Martinez
Guest
Posts: n/a
 
      3rd Oct 2003
In the code below, Alias is a VB keyword, so it normally cannot be used as a
variable. Putting the brackets around it tell VB that you want to use it as
a variable.

Karen

"al" <(E-Mail Removed)> wrote in message
news:0fac01c3898a$7f6c6c10$(E-Mail Removed)...
> I'm teaching myself VB.Net from books, and have come
> across the use of square brackets a couple of times in the
> code samples. But I can't find any reference as to why or
> what they are for.
>
> Thanks in advance
>
>
> E.G.
> Public Class ChatClient
> Inherits MarshalByRefObject
>
>
> Public Sub New(ByVal [alias] As String)
> Me.username = [alias]
> End Sub
> ...
> End Class
>
>



 
Reply With Quote
 
Lee Gillie
Guest
Posts: n/a
 
      3rd Oct 2003
Just like a REGULAR identifier (i.e. variable name), but when enclosed
in square brackets, then you may used reserved words. This is called
an escaped identifier.

Best regards - Lee Gillie

"al" <(E-Mail Removed)> wrote in message
news:0fac01c3898a$7f6c6c10$(E-Mail Removed)...
> I'm teaching myself VB.Net from books, and have come
> across the use of square brackets a couple of times in the
> code samples. But I can't find any reference as to why or
> what they are for.
>
> Thanks in advance
>
>
> E.G.
> Public Class ChatClient
> Inherits MarshalByRefObject
>
>
> Public Sub New(ByVal [alias] As String)
> Me.username = [alias]
> End Sub
> ...
> End Class
>
>



 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      4th Oct 2003
Hi Lee,

I don't know why it's called 'escaped' - it's obviously been captured and
put behind bars. :-))

Dim [Me] As Captured
[Me].NeedALawyer = True

Regards,
Fergus


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      4th Oct 2003
"Fergus Cooney" <filter-(E-Mail Removed)> scripsit:
> I don't know why it's called 'escaped'


You really do not know that?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      4th Oct 2003
Hi Herfried,

LOL. When God shared out the takes-things-literally gene, he gave you a
doubly-dominant version!!

It's a joke - a pun, geddit??

[BehindBars] = Not FreeAsABird

;-)

Regards,
Fergus

(-; || || || || || || || || || || || || ;-)


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      4th Oct 2003
"Fergus Cooney" <filter-(E-Mail Removed)> scripsit:
> LOL. When God shared out the takes-things-literally gene, he gave you a
> doubly-dominant version!!
>
> It's a joke - a pun, geddit??
>
> [BehindBars] = Not FreeAsABird
>
> ;-)


ROFL.

> (-; || || || || || || || || || || || || ;-)


I really _hate_ them.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Expression Builder basic question on syntax / Or / how to incorporatea SQL query into a textbox control? raylopez99 Microsoft Access Form Coding 16 3rd Jan 2008 04:54 AM
A basic CSS syntax question =?Utf-8?B?dGNhcnA=?= Microsoft Frontpage 8 20th Feb 2006 12:05 AM
Basic question....syntax on active cells from a filter =?Utf-8?B?Um9taW5hbGw=?= Microsoft Excel Programming 3 16th Feb 2006 10:14 PM
Newbie Question - Visual Basic .NET Express 2005 & syntax =?Utf-8?B?Q2hyaXNXaWxsaXM=?= Microsoft VB .NET 2 10th Jun 2005 07:13 AM
basic syntax question =?Utf-8?B?YWU=?= Microsoft ADO .NET 1 3rd Nov 2004 05:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:23 AM.