managing and searching text in textbox (Compact Framework)

devimore

Member
Joined
Jul 1, 2010
Messages
9
Programming Experience
5-10
Hey all..

Here is my problem..
I have a textbox (TextBox1)
it contains path, like (/program files/folder1/folder2)
Just like that..
So i need to search for LAST string = "/"
and delete it and everything it has after it, when a button is pressed, for example like this:

before pressed button:
/program files/folder1/folder2

after pressed button:
/program files/folder1

is it posible to do?
 

taurean100

Member
Joined
Aug 22, 2010
Messages
16
Programming Experience
3-5
Sure.

VB.NET:
        Dim parentFolder As String
        Dim subFolder As String = "/program files/folder1/folder2"
        Dim di As New System.IO.DirectoryInfo(subFolder)

        parentFolder = di.Parent.FullName '"/program files/folder1

        'Delete this and all sub-directories of folder2
        di.Delete(True) 'Delete "/program files/folder1/folder2"
 
Last edited:
Top Bottom