Hey all.
I have a problem,
I try to open a file, then i open the file, i want to get the size of the file and write in to a ListBox.
So if i have a file : 123,00 kb so then i push the button Ok then get the size of the file and write the size into the Listbox.
Cant some one here tell me how i doit, i have try and try, but its not work for me.
Here its my code.:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim alleAttr As Long
If System.IO.File.Exists(lblfilnavn.Text) Then
lstAttr.Items.Clear()
lstAttr.Items.Add("Make : " & System.IO.File.GetCreationTime(lblfilnavn.Text))
lstAttr.Items.Add("Open : " & System.IO.File.GetLastAccessTime(lblfilnavn.Text))
lstAttr.Items.Add("Change : " & System.IO.File.GetLastWriteTime(lblfilnavn.Text))
*********** Its that line i have problem with i cannot see how i doit.
lstAttr.Items.Add("Size : " & System.IO.File.Length(lblfilnavn.Text))
And i have try this one to
lstAttr.Items.Add("Size : " & System.IO.File.GetLength(lblfilnavn.Text))
alleAttr = System.IO.File.GetAttributes(lblfilnavn.Text)
lstAttr.Items.Add("")
lstAttr.Items.Add("Hidden : " & CBool(alleAttr And IO.FileAttributes.Hidden))
lstAttr.Items.Add("System : " & CBool(alleAttr And IO.FileAttributes.System))
lstAttr.Items.Add("ReadOnly : " & CBool(alleAttr And IO.FileAttributes.ReadOnly))
lstAttr.Items.Add("Arkivbit : " & CBool(alleAttr And IO.FileAttributes.Archive))
End If
End Sub
I hope some one here could help me out
I have a problem,
I try to open a file, then i open the file, i want to get the size of the file and write in to a ListBox.
So if i have a file : 123,00 kb so then i push the button Ok then get the size of the file and write the size into the Listbox.
Cant some one here tell me how i doit, i have try and try, but its not work for me.
Here its my code.:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim alleAttr As Long
If System.IO.File.Exists(lblfilnavn.Text) Then
lstAttr.Items.Clear()
lstAttr.Items.Add("Make : " & System.IO.File.GetCreationTime(lblfilnavn.Text))
lstAttr.Items.Add("Open : " & System.IO.File.GetLastAccessTime(lblfilnavn.Text))
lstAttr.Items.Add("Change : " & System.IO.File.GetLastWriteTime(lblfilnavn.Text))
*********** Its that line i have problem with i cannot see how i doit.
lstAttr.Items.Add("Size : " & System.IO.File.Length(lblfilnavn.Text))
And i have try this one to
lstAttr.Items.Add("Size : " & System.IO.File.GetLength(lblfilnavn.Text))
alleAttr = System.IO.File.GetAttributes(lblfilnavn.Text)
lstAttr.Items.Add("")
lstAttr.Items.Add("Hidden : " & CBool(alleAttr And IO.FileAttributes.Hidden))
lstAttr.Items.Add("System : " & CBool(alleAttr And IO.FileAttributes.System))
lstAttr.Items.Add("ReadOnly : " & CBool(alleAttr And IO.FileAttributes.ReadOnly))
lstAttr.Items.Add("Arkivbit : " & CBool(alleAttr And IO.FileAttributes.Archive))
End If
End Sub
I hope some one here could help me out