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.

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

This article has been dead for over six months. Start a new discussion instead.