|
-
Dec 10th, 2003, 10:37 AM
#1
Thread Starter
Addicted Member
Add up filesize - is it easy? *** RESOLVED - Thx vbNeo ***
I have the following in a rtb, how can i go through the rtb line by line and add up the SIZE: values ???????
PATH: C:\Temp\ss_nb.dat | NAME: ss_nb.dat | SIZE: 122 | DATE: 09/09/2003 13:50:29
PATH: C:\Temp\ss_udp.dat | NAME: ss_udp.dat | SIZE: 240 | DATE: 09/09/2003 13:50:33
PATH: C:\Temp\ss_udp2.dat | NAME: ss_udp2.dat | SIZE: 4 | DATE: 09/09/2003 13:50:33
PATH: C:\Temp\Strategy.ppt | NAME: Strategy.ppt | SIZE: 7921152 | DATE: 28/05/2003 11:32:32
Last edited by HELPmyVB; Dec 10th, 2003 at 11:27 AM.
-
Dec 10th, 2003, 10:40 AM
#2
Addicted Member
Can you tell me what is RTB?
If these informations are stored in a file then read it just line by line and split it using Split() function, you will get the segrigated values.
Good Luck.
Jai.
See you,
-Jai
[Friends Never Say Good Bye]
-
Dec 10th, 2003, 10:41 AM
#3
Fanatic Member
Easy as Pie. Hmm... I like pie
Look in your api text viewer for GetFileSize, look on http://msdn.microsoft.com for additional details. Post back if you need help.
-
Dec 10th, 2003, 10:41 AM
#4
Fanatic Member
-
Dec 10th, 2003, 10:50 AM
#5
Thread Starter
Addicted Member
I am in a real hurry to get this done, normally like to sort it out myself but need help to get it done quickly. Any chance ?
-
Dec 10th, 2003, 10:53 AM
#6
Supreme User
Seeming as you are from North West and not North East of UK i cant help you lol
Sorry, im no good with this stuff
-
Dec 10th, 2003, 10:56 AM
#7
Frenzied Member
well
Do you just want to change the string, or the files sizes itself ?
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Dec 10th, 2003, 10:56 AM
#8
Fanatic Member
-
Dec 10th, 2003, 11:02 AM
#9
Thread Starter
Addicted Member
vbNeo, what i need is a sub which adds up the filesizes as posted above and displays the answer in a messagebox e.g.
Total Filesize = 7,921,518
-
Dec 10th, 2003, 11:07 AM
#10
Frenzied Member
ohh
That's easy
Gimme a sec, I'll make something for you
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Dec 10th, 2003, 11:21 AM
#11
Frenzied Member
well
Try this:
VB Code:
Public Function AddUp(rtb As RichTextBox)
On Error Resume Next
Dim iStart As Integer
Dim iEnd As Integer
Dim iC As Integer
Dim iNumbers(1000) As Long
Dim Result As Long
iStart = 1
iC = 0
With rtb
Do Until iStart = 0
If InStr(iStart, .Text, "SIZE:") <= 0 Then
iStart = 0
Else
iStart = InStr(iStart, .Text, "SIZE:") + Len("SIZE:") + 1
iEnd = InStr(iStart, .Text, " ")
iNumbers(iC) = Val(Mid(.Text, iStart, iEnd - iStart))
iStart = iStart + 15
iC = iC + 1
End If
Loop
For I = 0 To iC
Result = Result + iNumbers(I)
Next
AddUp = Result
End With
End Function
call it with
VB Code:
MsgBox AddUp(RichTextBox1)
Hope it helps/works 
Cheers!
Last edited by vbNeo; Dec 10th, 2003 at 11:46 AM.
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
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
|