|
-
Jul 9th, 2001, 08:56 AM
#1
Thread Starter
Fanatic Member
Simple Divison!
This i s what i need. I open a file using common dialog and then load in text box. I get the file size in bytes using filelen() and then i need to divide the filelen by 1500000 bytes and then add 1 to that number how would i do that?
mysize / 1500000 + 1 doesn't work ?
Code:
Private Sub Command1_Click()
cd1.Filter = "All Files|*.*"
cd1.ShowOpen
Text1.Text = cd1.FileName
End Sub
Private Sub Command2_Click()
Dim MySize As Integer
Dim Accounts
If Text1.Text = "" Then
MsgBox ("Please Load File First :-)!")
Else
MySize = FileLen(cd1.FileName)
mysize / 1500000 + 1
End If
End Sub
-
Jul 9th, 2001, 08:58 AM
#2
Lively Member
An Integer is a number from -32,768 to 32,767.
You need a Long which is a number from -2,147,483,648 to 2,147,483,647
That is:
Dim MySize As Long
-
Jul 9th, 2001, 09:00 AM
#3
Lively Member
You could also use Double which is from
-1.79769313486232E308 to
-4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values
-
Jul 9th, 2001, 09:01 AM
#4
You can't use an Integer! Declare MySize as a Long instead.
(1500000 is to large for an Integer. Max size = 32767)
-
Jul 9th, 2001, 09:02 AM
#5
Hyperactive Member
Re: Simple Divison!
Originally posted by stickman373
mysize / 1500000 + 1 doesn't work ?
Code:
Private Sub Command1_Click()
cd1.Filter = "All Files|*.*"
cd1.ShowOpen
Text1.Text = cd1.FileName
End Sub
Private Sub Command2_Click()
Dim MySize As Integer
Dim Accounts
If Text1.Text = "" Then
MsgBox ("Please Load File First :-)!")
Else
MySize = FileLen(cd1.FileName)
mysize / 1500000 + 1
End If
End Sub
I don't know what you are using Accounts for but how about...
Dim Accounts as Long
Accounts = MySize / 1500000 + 1
Thats right too big for an int
-
Jul 9th, 2001, 09:04 AM
#6
Whoops! Fast replys here! 
I think a Long will be enough if your file isn't bigger then 2Gb.
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
|