Results 1 to 2 of 2

Thread: [RESOLVED] how to access the path location in listview

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] how to access the path location in listview

    I would like to know, How I can access the path location in the listview? I have two column, named filename and location. I also able to search the filename in my directory and display the filename and its path location in the listview.

    So I want to access the path location in the listview so that I can display the table. How to do that?

    for example, I select the the list from listview and show the table.

    How to remove the filename in the path location in the textbox? When the filename found. It show the full path location with the filename like this c:\project\data\block\blockc.shp .
    Actually I just want to show the path location like this

    c:\project\data\block\ . how to remove it?

    Code:
    Private Sub Insertsub(tempstr As String)
    Dim i As Long
    Dim sName() As String
    Dim sPath As String
    sName = Split(tempstr, "\") 'contains File name'
    
        Dim lvItem As ListItem
    
        Set lvItem = ListView1.ListItems.Add(, , sName(UBound(sName)))
            lvItem.ListSubItems.Add , , "" & Left$(tempstr, InStr(1, tempstr, Chr$(0)) - 1)
            Text2.Text = sName(UBound(sName)) ' show the data filename
            Text3.Text = tempstr ' show the path location
    
    End Sub

    Code:
    Private Sub Command1_Click() ' search button. When the file name found.It and display it in the listview
        Dim tempstr As String, Ret As Long
      
        tempstr = String(MAX_PATH, 0)
        'returns 1 when successfull, 0 when failed
    Ret = SearchTreeForFile("C:\Project\Data\", Text1.Text + ".shp", tempstr)
    If Ret <> 0 Then Call Insertsub(tempstr)
    ret2 = SearchTreeForFile("C:\Project\Data\", Text1.Text + ".img", tempstr)
    If ret2 <> 0 Then Call Insertsub(tempstr)
    If Ret = 0 And ret2 = 0 Then MsgBox "File not found"
    End Sub
    Attached Images Attached Images  
    Last edited by matrik02; Jun 2nd, 2007 at 06:57 AM.

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