473,794 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What Does This Mean?

I found this statement in some sample code. It seems to be syntactically
correct. What do the brackets around "String" mean?

Dim sWork As [String] = "Some number of characters"

Dec 11 '06 #1
13 1994
"Herman Jones" <He*********@di scussions.micro soft.comwrote in message
news:6F******** *************** ***********@mic rosoft.com...
>I found this statement in some sample code. It seems to be syntactically
correct. What do the brackets around "String" mean?

Dim sWork As [String] = "Some number of characters"
They are used indicate the item in the brackets is not a keyword. For
example if you wanted to name a variable Dim you might be able to do this:

Dim [Dim] as Int32
[Dim] = 5

I'm not sure if that works but that the sort of thing it's used for. It
could be used for function names, class names etc. In the case of String
above it does nothing but doesn't cause any problems either. You can remove
them.

Michael
Dec 11 '06 #2
This example seems to be a little different. In your example you're using
[Dim] as a variable name. It comes before the "As" keyword.

The sample code I found has [String] after the "As" keyword. I don't thing
that "String" is being used as the variable name because the program later
refers to the "sWork" variable.

Is it possible that the brackets have some other purpose when they bracket a
datatype?

"Michael C" wrote:
"Herman Jones" <He*********@di scussions.micro soft.comwrote in message
news:6F******** *************** ***********@mic rosoft.com...
I found this statement in some sample code. It seems to be syntactically
correct. What do the brackets around "String" mean?

Dim sWork As [String] = "Some number of characters"

They are used indicate the item in the brackets is not a keyword. For
example if you wanted to name a variable Dim you might be able to do this:

Dim [Dim] as Int32
[Dim] = 5

I'm not sure if that works but that the sort of thing it's used for. It
could be used for function names, class names etc. In the case of String
above it does nothing but doesn't cause any problems either. You can remove
them.

Michael
Dec 11 '06 #3
"Herman Jones" <He*********@di scussions.micro soft.comwrote in message
news:2E******** *************** ***********@mic rosoft.com...
This example seems to be a little different. In your example you're using
[Dim] as a variable name. It comes before the "As" keyword.

The sample code I found has [String] after the "As" keyword. I don't
thing
that "String" is being used as the variable name because the program later
refers to the "sWork" variable.

Is it possible that the brackets have some other purpose when they bracket
a
datatype?
The dim was just 1 example, it can be used in many places. If a program had
a datatype called "As" then you'd need to do Dim x as [As]

Michael
Dec 11 '06 #4
>I found this statement in some sample code. It seems to be syntactically
correct. What do the brackets around "String" mean?

Dim sWork As [String] = "Some number of characters"
That the programmer of this program is probably an idiot.
You replace with this the general meaning of the keyword.

Public Class Form1
Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim a As New [String](1)
Dim b As String = "What the hell is this"
End Sub
End Class
Public Class [String]
Public Sub New(ByVal b As Integer)
b = b
End Sub
Public b As Integer
End Class

Cor
Dec 11 '06 #5
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Public Sub New(ByVal b As Integer)
b = b
End Sub
Public b As Integer
Does that actually work in vb.net?

Michael
Dec 11 '06 #6
It runs and gives very strange results.

Cor

"Michael C" <no****@nospam. comschreef in bericht
news:OF******** ******@TK2MSFTN GP02.phx.gbl...
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
> Public Sub New(ByVal b As Integer)
b = b
End Sub
Public b As Integer

Does that actually work in vb.net?

Michael

Dec 11 '06 #7
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:u%******** ********@TK2MSF TNGP03.phx.gbl. ..
It runs and gives very strange results.
Would it just leave this.b = 0 or uninitialised?

Michael
Dec 11 '06 #8
Try it and find out!
"Michael C" <no****@nospam. comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:u%******** ********@TK2MSF TNGP03.phx.gbl. ..
>It runs and gives very strange results.

Would it just leave this.b = 0 or uninitialised?

Michael

Dec 11 '06 #9
zero

"Michael C" <no****@nospam. comschreef in bericht
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:u%******** ********@TK2MSF TNGP03.phx.gbl. ..
>It runs and gives very strange results.

Would it just leave this.b = 0 or uninitialised?

Michael

Dec 11 '06 #10

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

Similar topics

125
14858
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
3
29681
by: Jukka K. Korpela | last post by:
I have noticed that the meaning of visibility: collapse has been discussed on different forums, but with no consensus on what it really means. Besides, implementations differ. The specification says: "The 'visibility' property takes the value 'collapse' for row, row group, column, and column group elements. This value causes the entire row or column to be removed from the display, and the space normally taken up by the row or column to...
2
10218
by: Steve Richter | last post by:
What does the "." mean in the following sql script stmts? use GO if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id,N'IsUserTable') = 1) drop table . GO
121
10185
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
13
5060
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10433
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10161
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6777
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.