Results 1 to 3 of 3

Thread: cant get my file browser to show correct file type - check out the screenshot

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    49

    cant get my file browser to show correct file type - check out the screenshot

    can someone help me get the file types to show up correctly? It should say the type such as text document, excel spreadsheet...etc. can someone tell me how i should change the fl.GetType.ToString to get it to show up right?

    Here is what it looks like now



    VB Code:
    1. Dim fldr As DirectoryInfo
    2.         Dim fl As FileInfo
    3.         Dim count As Integer
    4.         Dim tempFile
    5.         Dim pos As Integer
    6.  
    7.         Try
    8.             Directory.SetCurrentDirectory(txtPath.Text())
    9.         Catch e As Exception
    10.             MsgBox(e.Message(), MsgBoxStyle.Critical, "")
    11.             Exit Sub
    12.         End Try
    13.  
    14.         listView1.Items.Clear()
    15.  
    16.         Dim currFldr As New DirectoryInfo(Directory.GetCurrentDirectory)
    17.  
    18.         If currFldr.FullName() <> currFldr.Root.ToString Then
    19.             listView1.Items.Add("..", 1)
    20.             count += 1
    21.         End If
    22.  
    23.         For Each fldr In currFldr.GetDirectories()
    24.             If File.Exists(fldr.Name + "\folder.jpg") Then
    25.                 With listView1
    26.                     .Items.Add(fldr.Name, 3)
    27.                     .Items(count).SubItems.Add("")
    28.                     .Items(count).SubItems.Add(fldr.GetType.Name())
    29.                     .Items(count).SubItems.Add(fldr.LastWriteTime)
    30.                 End With
    31.             Else
    32.                 With listView1
    33.                     .Items.Add(fldr.Name, 2)
    34.                     .Items(count).SubItems.Add("")
    35.                     .Items(count).SubItems.Add(fldr.GetType.Name())
    36.                     .Items(count).SubItems.Add(fldr.LastWriteTime)
    37.                 End With
    38.             End If
    39.             count += 1
    40.         Next
    41.  
    42.         For Each fl In currFldr.GetFiles()
    43.             tempFile = fl.Name()
    44.             pos = tempFile.LastIndexOf(".")
    45.  
    46.             If pos > 0 Then
    47.                 tempFile = tempFile.Substring(0, pos)
    48.             End If
    49.  
    50.             If File.Exists(tempFile + ".tbn") Then
    51.                 With listView1
    52.                     .Items.Add(fl.Name, 5)
    53.                     .Items(count).SubItems.Add(Format(Math.Ceiling(fl.Length / 1024), "###,###,###,###,###") & " KB")
    54.                     .Items(count).SubItems.Add(fl.GetType.ToString)
    55.                     .Items(count).SubItems.Add(fl.LastWriteTime)
    56.                 End With
    57.             Else
    58.                 With listView1
    59.                     .Items.Add(fl.Name, 4)
    60.                     .Items(count).SubItems.Add(Format(Math.Ceiling(fl.Length / 1024), "###,###,###,###,###") & " KB")
    61.                     .Items(count).SubItems.Add(fl.GetType.ToString)
    62.                     .Items(count).SubItems.Add(fl.LastWriteTime)
    63.                 End With
    64.             End If
    65.             count += 1
    66.         Next
    Last edited by charvelzeppelin; Jan 16th, 2005 at 02:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width