The problem is it show the full path location in the text3 like c:\project\data\block\lot.shp. How to remove the filename so that it look like c:\project\data\block\ in the textbox?
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
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

New Topic/Question
Reply





MultiQuote



|