i wanna to get size of file.
help me how to get this. anyone know how to do this.
any help will be appreciated :)

try this following code :

'This project needs
' -a Command Button (Command1)
' -a CommonDialog (CommonDialog1)
' -a Label (Label1)
Private Const OF_READ = &H0&
Private Declare Function lOpen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long
Private Declare Function lclose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long
Private Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Dim lpFSHigh As Long
Public Sub GetInfoF(FilePath As String)
    Dim Pointer As Long, sizeofthefile As Long
    Pointer = lOpen(FilePath, OF_READ)
    'size of the file
    sizeofthefile = GetFileSize(Pointer, lpFSHigh)
    Label1.Caption = sizeofthefile & " bytes"
    lclose Pointer
End Sub
Private Sub command1_Click()
    CommonDialog1.ShowOpen
    GetInfoF CommonDialog1.filename
End Sub
Private Sub Form_Load()
    With CommonDialog1
        .DialogTitle = "Select a file"
        .Filter = "All the files|*.*"
    End With
    Command1.Caption = "Select a file"
End Sub

Hope this helps...

commented: you're the best ..... :) Thank you +1
commented: helping +1
commented: Through my mind +1

i wanna to get size of file.
help me how to get this. anyone know how to do this.
any help will be appreciated :)

this is a simple but efficient code..

Dim fln,result
Dim fname as String

fname="c:\windows\regedit.exe"

fln = FileLen(trim(fname))
result = CInt((fln / 1024) / 1024) & " MB" & "(" & fln & " BYTES)"

Msgbox "FileSize is -->" & result

you will display a message box containing this text :-

FileSize is --> 9 MB(9016447 BYTES)

hope this helps you.

regards
Shouvik

commented: much efficient :) +1

hi shouvik, its a nice code :)

thanks buddy
i didn't ever try to underestimate your code.
that's a great one too.

i just tried to show thats there is an alternate solution too.

regards
Shouvik

don't felt that, i really like your code.
i happy to know much from you too. you are the great coder, your code always help me and others. So, many alternative solution make it more completed.

commented: very welcome :) +1

awesome
both of you is a great coder...

thanks for all your helps guys
i m very happy :D

awesome
both of you is a great coder...

thanks for all your helps guys
i m very happy :D

Thank you...
We just give what we know and glad to share our knowledge :)
Happy coding Friend.

commented: thanks you want to share your knowledge jx_man :) +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.