473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Get size of file using vb.net

Hello everyone,

I need to get the size of a file using vb.net. I have tried using the
Length property from the FileInfo class, but the values its returning
aren't making any sense. For example, I had a 1 KB file and the value
returned was 358. For another 1 KB file, the value 160 was returned.

Thanks

Nov 29 '05 #1
4 10173
"XxLicherxX" <go********@aol.com> schrieb:
I need to get the size of a file using vb.net. I have tried using the
Length property from the FileInfo class, but the values its returning
aren't making any sense. For example, I had a 1 KB file and the value
returned was 358. For another 1 KB file, the value 160 was returned.


How did you determine that the file's size is 1 KB?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 29 '05 #2
Windows explorer with the details view... but if I right click and do
properties 358 bytes. Now I get it. Windows explorer must round up.

Thanks

Nov 29 '05 #3
yes, it generally does for the detail views and status messages for a file.
To get the actual size always use the files properties.

"XxLicherxX" <go********@aol.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Windows explorer with the details view... but if I right click and do
properties 358 bytes. Now I get it. Windows explorer must round up.

Thanks

Nov 30 '05 #4
remember that cluster size on disk has an effect on the "size" explorer
reports too... NTFS clusters are usually 4KB in size... so a 100 byte file
actually takes up 4KB on the disk

"XxLicherxX" <go********@aol.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Windows explorer with the details view... but if I right click and do
properties 358 bytes. Now I get it. Windows explorer must round up.

Thanks

Nov 30 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thomas | last post by:
What's the quickest way to write and read 10.000 integer values ( or more ) to and from a file? Using struct somehow? The example in the docs shows how to handle to or three arguments, but is the...
2
by: Vilmar Brazão de Oliveira | last post by:
Hi, How verify type or extension of file using ASPUPLOAD? I check documentation, but I didn't find anything else yet. thanks, -- ««««««««»»»»»»»»»»»»»» Vlmar Brazão de Oliveira...
2
by: Paul LAURENT | last post by:
Hi everybody, I am using the STL "ofstream" class. I open a file using "ofstream" in update at the end mode ("ate"), I can read and write my file correctly. => What I would like to do is...
3
by: syntax | last post by:
hi, i want to read a file using fread() in equal chunks through a for loop so that at the last call i dont get error..which way, i should read it? let me give an example, suppose i have 100...
11
by: MrNobody | last post by:
I need to zip up an 8Gb file using C# - do you know of any freeware libraries I can use to accomplish this? I guess it needs to be Zip64 to support such file sizes. I tried something called...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
3
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
4
by: Pranjal9880 | last post by:
Hi all I am trying to parse the xml file using perl in which I am succeeded , I am able to fetch the data from the xml file by using one keyword. Now I want to do it using more than one keyword. It...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.