|
-
Oct 21st, 2007, 07:43 PM
#1
Thread Starter
Member
How to add data in a variable
Hi guys, im having trouble with my script about data adding to a variable, here is the scenario :
dim buff as string,message1 as string,message2 as string _
combineMessage as string,realMess as string
buff = "" <--- initial variable
for x = 1 to 10
message1=mid(realMess,x,1)
combineMessage=message1 & buff <--- combine the two message
buff=left(combineMessage,2) <--- get the data to be added for the next loop
next
what i wanted is after getting the buff data, its contents will be added to the combineMessage after the next loop, but what happens is the same buff data i being generated.
-
Oct 21st, 2007, 08:53 PM
#2
Frenzied Member
Re: How to add data in a variable
What is in RealMess? I don't see anything being put into it.
What exactly do you want to achieve with this code?
-
Oct 21st, 2007, 09:33 PM
#3
Thread Starter
Member
Re: How to add data in a variable
hi jeroen, what i wanted is for the buff variable found at the end of the script,
to be added in the next loop, for example, at the first run of the loop, the value of buff = "", after the second loop, the value will buff="something", then after the 3rd loop, buff="somethingNewsomething" until the end of the loop, data just keeps on appending to the buff variable.
-
Oct 21st, 2007, 10:01 PM
#4
Frenzied Member
Re: How to add data in a variable
Where is it supposed to get all the somethings?
-
Oct 21st, 2007, 10:06 PM
#5
Thread Starter
Member
Re: How to add data in a variable
Hi jeroen, here is my actual script
Private Function DecodeHex(ByVal dstr As String) As String
Dim bStr As String, xl As Long, chopMes As String, mStr As String, strtP As Long, realMes As String, mesStr As String _
, bit1 As String, bit2 As String
bStr = ""
For xl = 1 To Len(dstr) Step 2
bit1 = HextoBin(Mid(dstr, xl, 1))
bit2 = HextoBin(Mid(dstr, xl + 1, 1))
chopMes = bit1 & bit2
mStr = chopMes & bStr 'combined bits
strtP = Len(mStr) - 6
realMes = Mid(mStr, strtP, 7)
bStr = bStr & Mid(mStr, 1, strtP - 1) 'get bit adder <---data not adding here
'convert bin data to dec
Dim xc As Integer, decN As Long
mesStr = mesStr & Chr(calcbin2den(realMes))
Next
DecodeHex = mesStr
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|