delete path..
-
can anyone please give me sample code or example for deleting part of the string.. Dim str As String str = "c:\temp\folder1" how can i delete "\folder1" from str so str will be only "c:\temp" I know how to do in c++ but do not know how to do in VB though. Is String has any functions like CString? in C++ i can use CString::Find('\') and CString::Right() methods.. what about in VB. any functions that will do the same as above functions??? thank you
-
can anyone please give me sample code or example for deleting part of the string.. Dim str As String str = "c:\temp\folder1" how can i delete "\folder1" from str so str will be only "c:\temp" I know how to do in c++ but do not know how to do in VB though. Is String has any functions like CString? in C++ i can use CString::Find('\') and CString::Right() methods.. what about in VB. any functions that will do the same as above functions??? thank you
I got it.. that's what i did Dim fileName As String Dim path As String Dim index As Integer path = "c:\temp\testing\folder" path = frmPrinterProperties.IDpath.Text ' deleting the last folder name.. index = InStrRev(path, "\", -1, 1) ' find "\" reversly in the path string path = Mid(path, 1, index) ' get what ever right before "\" fileName = path & "new folder" ' now "c:\temp\testing\new folder"