473,412 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Basic Syntax question -- Sorry :-$

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
Nov 20 '05 #1
8 2635
"al" <al******@hotmail.com> 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>
Nov 20 '05 #2
in other words you can replace [this] w a name you choose (normally a name
of a variable)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bl************@ID-208219.news.uni-berlin.de...
"al" <al******@hotmail.com> 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>

Nov 20 '05 #3
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" <al******@hotmail.com> wrote in message
news:0f****************************@phx.gbl...
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

Nov 20 '05 #4
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" <al******@hotmail.com> wrote in message
news:0f****************************@phx.gbl...
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

Nov 20 '05 #5
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
Nov 20 '05 #6
"Fergus Cooney" <fi******@tesco.net> 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>
Nov 20 '05 #7
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

(-; || || || || || || || || || || || || ;-)
Nov 20 '05 #8
"Fergus Cooney" <fi******@tesco.net> 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>
Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: jesse | last post by:
In java, one constructor can call another constructor through this(...) for instance class foo { public: foo(int k) { this(k,false)}; foo(int k, boolean m){...}; }
44
by: Truble | last post by:
Visual Studio .NET is not more efficient to write than VB6. I can write a VB6 App at least twice as fast as in .NET. Why did Microsoft ruin the syntax advantage of VB6 in .NET?
3
by: Mike Christie | last post by:
I've got some Java experience but no JSP or ASP and am trying to get to grips with ASP.NET. I'd appreciate some help on a simple question. I have been able to get databinding to work, and can...
4
by: Mark Linehan | last post by:
Greetings and salutations. I began programming God knows how many years ago in basic on the Commodore 64. I dabbled in a little assembly as well. I moved on to the PC eventually and stuck with...
3
by: blackdevil1979 | last post by:
Hi, Anyone here familiar with crystal syntax or basic syntax. I need some help....
7
by: gerryLowry::Ability Business Computer Services {KC | last post by:
"Getting Back Your Visual Basic 6.0 Goodies" by Billy Hollis, 2003-5-14, states: "Getting a Forms Collection Visual Basic 6.0 developers are often fond of looping through the currently loaded...
13
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format...
6
by: John Bailo | last post by:
http://www.informationweek.com/software/showArticle.jhtml?articleID=196600515 Developers Embrace Java, Drop Visual Basic "Developers have abandoned Microsoft's Visual Basic in droves during...
4
by: Chris Asaipillai | last post by:
Hi there My compay has a number of Visual Basic 6 applications which are front endeed onto either SQL Server or Microsoft Access databases. Now we are in process of planning to re-write these...
43
by: Bill H | last post by:
25 years ago every computer came with some form of Basic interpreter so you could use yoru computer without having to buy more software. Is Javascript (teamed with HTML) set to become the new...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.