By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,231 Members | 1,747 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,231 IT Pros & Developers. It's quick & easy.

Calculate File Size on Disk in KB

P: 22
Hey Frnds to calculate the File Size everytime we have to give extension such as .txt,.doc.
AS FOLL--
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3. Dim filelength As Long 
  4. filelength = GetFileSize("D:\Documents and Settings\Administrator\Desktop\Private Function SaveDetails[1].doc")
  5. MsgBox(filelength)
  6. End Sub
  7.  
  8. Private Function GetFileSize(ByVal MyFilePath As String) As Long
  9. Dim MyFile As New FileInfo(MyFilePath)
  10. Dim FileSize As Long = MyFile.Length / 1024
  11. Return FileSize
  12. End Function
  13.  
I want that Only I change the File name & it computes the Size everytime giving the extension.......
Plz do reply back,I will be very thxful to u.
Jun 22 '08 #1
Share this Question
Share on Google+
1 Reply


Plater
Expert 5K+
P: 7,872
You appear to already have a function to give you the file size in KB.
What is the problem?
Jun 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.