943,865 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 51059
  • VB.NET RSS
Sep 12th, 2007
0

Finding file size

Expand Post »
Can any one give me code for finding size of my log file using VB.NET????
Also I want the code to make my log file of 1KB only and not more than that.
Similar Threads
bcm
Reputation Points: 18
Solved Threads: 0
Junior Poster in Training
bcm is offline Offline
63 posts
since Aug 2007
Nov 19th, 2007
0

Re: Finding file size

Click to Expand / Collapse  Quote originally posted by bcm ...
Can any one give me code for finding size of my log file using VB.NET????
Also I want the code to make my log file of 1KB only and not more than that.

I want vb.net code for getting file size for a particular log file and delete data based on date if the file size exceeds the limit.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
melvincmathew is offline Offline
3 posts
since Nov 2007
Nov 19th, 2007
0

Re: Finding file size

please send me the code for the above mentioned one..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
melvincmathew is offline Offline
3 posts
since Nov 2007
Nov 19th, 2007
0

Re: Finding file size

To Get File Size:
=============

Imports System.IO

Private Function GetFileSize(ByVal MyFilePath As String) As Long
Dim MyFile As New FileInfo(MyFilePath)
Dim FileSize As Long = MyFile.Length
Return FileSize
End Function


DELETE COMMAND:
============
MyFile.Delete()

Make sure the file is not ReadOnly, AlreadyInUse B4 deleting, or u get exception.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MehdiAnis is offline Offline
12 posts
since Nov 2007
Nov 20th, 2007
0

Re: Finding file size

Thanks for the code

I need the code for opening the file and deleting based on date..

please help me.. the other code was really helpfull..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
melvincmathew is offline Offline
3 posts
since Nov 2007
Jun 15th, 2010
0
Re: Finding file size
3 years later but thanks for the code!!!
always nice to quickly get a working sample code from a simple google search.

yoann (www.prodeos.fr)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
prodeos is offline Offline
1 posts
since Jan 2010
Jun 17th, 2010
0
Re: Finding file size
I'm glad you got it helpful.

Please do not resurrect old threads. If you have any questions please ask. You are welcome to start your own threads.

Have a look at forum rules.
Please read before posting - http://www.daniweb.com/forums/thread78223.html

Thread Closed.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in VB.NET Forum Timeline: Sql server connection using code in VB.NET
Next Thread in VB.NET Forum Timeline: Get process by name





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC