Lowyat.NET Forums

Welcome Guest ( Log In | Register )

LYN wins Intel-Lenovo-Tangs Blogathon challenge. Thank you everybody!
 
RSS feedBump TopicReply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> Clearing VB String Datatype (VB)

carbonytte
post Oct 28 2009, 02:57 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #1


Casual
***

Group: Junior Member
Posts: 307
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2003
From: PNG / PJ






Hi.

IN VB/VBA there's a Clear method which can be use to clear things such as cells format, or a list-textbox, but how do you use it clear a variable?

Let say that I'm using a variable within a nested for loop (two concurrent loops, for i ... { for j .... next j} next i} kinda thing

On the inner loop i'm adding some values to the string, and eventually i will read it out and then clear it before the next outer loop iteration. How my code looks (example) :

CODE

dim I as Integer
dim J as Integer
dim X as String

For I = 0 to 10
  For J = 0 to 10
     X = X + ", 3"
  Next J
MsgBox X
'This is where I need to clear back X
Next I


What I would expect as the result is 10x message box of output which should read ",3,3,3,3,3,3,3,3,3,3,3". (Of course, this is just an example, but my code is something like this, just to get you guys to understand the question).

I tried using X.Clear but I receive error = Invalid qualifier

This post has been edited by carbonytte: Oct 28 2009, 02:57 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
unrealweapon
post Oct 28 2009, 03:21 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #2


\(^0^)/
****

Group: Senior Member
Posts: 570
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2008
From: a box within a box






just use X=""
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
taitianhin
post Oct 29 2009, 03:39 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #3


Getting Started
**

Group: Junior Member
Posts: 82
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Apr 2005
From: too far to see





QUOTE(unrealweapon @ Oct 28 2009, 03:21 PM)
just use X=""
*


X= nothing
or X = null
better...muhahha
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Bump TopicReply to this topicTopic OptionsStart new topic
 



----debug section please ignore----
Lo-Fi Version Time is now: 25th November 2009 - 06:34 AM
All Rights Reserved 2003-2009 Vijandren Ramadass (~living on a prayer~)