Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
variable increment
Logged in as: Guest
arrSession:exec spGetSession 2,2,891
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> variable increment
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
variable increment -
8/11/2003 6:37:53 AM
BaRRon
Posts: 2
Score: 0
Joined: 8/11/2003
From:
Status:
offline
Hi everybody
I have a variable I would like to increment 1 by 1 in vbscript
It looks like '001' untill '999'
My problem is when I add '1' to the value '005' (by example) , it don't return '006' but '6' .
I would like to keep this syntax '006'
So what do you propose please ?! ; )
thx
Post #: 1
RE: variable increment -
3/30/2006 5:54:46 AM
ebgreen
Posts: 5043
Score: 31
Joined: 7/12/2005
Status:
offline
Old question but I'll answer it for the sake of future searchers. This would do it:
For i = 1 To 999
Wscript.Echo Right("000" & i, 3)
Next
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:
http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
(in reply to
BaRRon
)
Post #: 2
RE: variable increment -
3/30/2006 5:58:31 AM
hamboy
Posts: 94
Score: 6
Joined: 7/11/2005
Status:
offline
would like to add to this...
for vbscript, what are the variations of incrementing values
ie.
x = x+1
i know some programs can do this..
x++
x=+1
is it better to just use x = x+1? because when I use other variations, it doesn't seem to work the same
< Message edited by
hamboy
--
3/30/2006 5:59:36 AM
>
(in reply to
ebgreen
)
Post #: 3
RE: variable increment -
3/30/2006 6:00:39 AM
ebgreen
Posts: 5043
Score: 31
Joined: 7/12/2005
Status:
offline
VBScript does not support increment operators. x = x + 1 is the only valid syntaxt.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:
http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
(in reply to
hamboy
)
Post #: 4
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> variable increment
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI