Basic Syntax question -- Sorry :-$

  • Thread starter Thread starter al
  • Start date Start date
A

al

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
 
in other words you can replace [this] w a name you choose (normally a name
of a variable)
 
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
 
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
 
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
 
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

(-; || || || || || || || || || || || || ;-)
 
Fergus Cooney said:
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.
 
Back
Top