473,804 Members | 3,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When do I have do define variables with "DIM" ?

Occasionally I saw VBS script where local variables were declared on top
with a statement like

DIM myvar

However most of my own vbs script run without such declaration.
When do I need them and when not?

Tony

Jun 27 '08 #1
3 1023
Tony, VB.NET and VBS are two completely different animals.

Please do NOT post, (or crosspost), matters relating to VBS to
microsoft.publi c.dotnet.langua ges.vb.
"Tony Bansten" <to******@hotma il.comwrote in message
news:48******** **************@ newsspool3.arco r-online.net...
Occasionally I saw VBS script where local variables were declared on top
with a statement like

DIM myvar

However most of my own vbs script run without such declaration.
When do I need them and when not?

Tony
Jun 27 '08 #2
I have answered this one yesterday in "microsoft.publ ic.scripting.vb script"
although the question and answer could have been the same for VBA, VB6 ,
VB.Net ( explicit VS implicit declaration )

See every VB like language as a human from a different family maybe one
language is less evolved but they are sure not another species
regards

Michel Posseth

"Stephany Young" <noone@localhos tschreef in bericht
news:Og******** ********@TK2MSF TNGP02.phx.gbl. ..
Tony, VB.NET and VBS are two completely different animals.

Please do NOT post, (or crosspost), matters relating to VBS to
microsoft.publi c.dotnet.langua ges.vb.
"Tony Bansten" <to******@hotma il.comwrote in message
news:48******** **************@ newsspool3.arco r-online.net...
>Occasionally I saw VBS script where local variables were declared on top
with a statement like

DIM myvar

However most of my own vbs script run without such declaration.
When do I need them and when not?

Tony

Jun 28 '08 #3
Michel,

I don't like this guy, it is not a Comunity person, he only wants to consume
answers, drops in all kind of newsgroups post and set his follow up to one
newsgroup, so we cannot see what the other answers were. Because this is as
well used by somebody using a woman name, and it started at the same time, I
think that it is the same poster.

I have tried this a while with the name Corrina, but that was not serious
(Herfried knows this)

But it seems that Stephany likes this kind of behaviour.

:-)

Cor

"Michel Posseth [MCP]" <MS**@posseth.c omschreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I have answered this one yesterday in "microsoft.publ ic.scripting.vb script"
although the question and answer could have been the same for VBA, VB6 ,
VB.Net ( explicit VS implicit declaration )

See every VB like language as a human from a different family maybe one
language is less evolved but they are sure not another species
regards

Michel Posseth

"Stephany Young" <noone@localhos tschreef in bericht
news:Og******** ********@TK2MSF TNGP02.phx.gbl. ..
>Tony, VB.NET and VBS are two completely different animals.

Please do NOT post, (or crosspost), matters relating to VBS to
microsoft.publ ic.dotnet.langu ages.vb.
"Tony Bansten" <to******@hotma il.comwrote in message
news:48******* *************** @newsspool3.arc or-online.net...
>>Occasionall y I saw VBS script where local variables were declared on top
with a statement like

DIM myvar

However most of my own vbs script run without such declaration.
When do I need them and when not?

Tony

Jun 28 '08 #4

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

Similar topics

4
21557
by: Monte | last post by:
It compiles fine in one of my ms2002 databases, but on another db (I inherited from somebody else), I get this compile error: "User-defined type not defined" Is something turned off in this second db or something? Thanks much
3
2501
by: Johnny M | last post by:
using Access 2003 Pardon the subject line, but I don't have a better word for this strange behavior (or behavior I don't understand!!!) I have a class module named DepreciationFactor. One of the properties is a follows (irrelevant code omitted):
3
17002
by: Bart Lateur | last post by:
For some reason, "Database" isn't recognised by Access as a built-in/predefined type, in Access' own VBA. Whenever I try to compile a line like Dim db as Database I get the complaint that that user defined type ("database") isn't defined. This happens both in Access 97 (on Win98) and in Access 2000 (on XP). I seem to recall this used to work on Access 2. For the rest, Access works normally.
1
3594
by: iam247 | last post by:
Hi I have a web page which receives information from a form (using request.form) and also attempts to look at an Access query to read in recoeds to a variable named rsGroup. When I have the following line commented, so it does not activate, I can successfully print all of the response.write's below: rsGroup.Open strSQL, adoCon
0
6281
by: Rob Meade | last post by:
Hi all, I've written a small app which firstly reads in from an xml config file to set some start parameters. once this is done, it takes the supplied path from the config file, iterates through it finding each .ini file, and parses each one. It basically strips out lines I dont want. When it gets to the end it's supposed to write the file back with the
6
1220
by: Rob Meade | last post by:
Hi all, Ok - I've used the word gramatically - which I'm sure is incorect, however I mean when VS2005 lists "warnings" like this one: Warning 1 Variable 'Command' is used before it has been assigned a value. A null reference exception could result at runtime. Warning 2 Variable 'Connection' is used before it has been assigned a value. A null reference exception could result at runtime. Warning 3 Variable 'Command' is used before it...
4
5542
by: Vincent Finn | last post by:
Hi, in some code I have there is a variable declared as Dim as String what is the for in this case? I thought it was an array at first but as far as I can tell the variable is just a string
17
1585
by: Tim Baur | last post by:
Hi All, I'm a VB6er who's recently started using VB2005; I have a general question about variable declaration. In VB, I've always tried to avoid using the "As New" construct when declaring a variable preferring instead to instantiate in the class' or form's initialize event or as needed. Using "As New" created unnecessary overhead and resulted in a loss of control over my object's life cycle. Is this advisable practice in .Net?
5
1613
by: Matt | last post by:
Ok so I'm trying to run a simple dos command shell through a VB.NET 2005 program. The oddest thing is happening given the following piece of code: '============================================================ '=== VARIABLE DECLARATION AND INITIALIZATION ================ '============================================================ '---General Variables------------------------------------ Dim CMDProcess As Process = New Process
0
9579
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
10571
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...
0
10326
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
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
10075
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...
1
7615
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.