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.
:'(

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.

please send me the code for the above mentioned one..

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.

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..

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)

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.