vb.net - Directory Count and text return -


i hope can me.

enter image description here

the image shows needs program code not work properly.

imports system.text.regularexpressions    public class form1      private sub button1_click(sender object, e eventargs) handles button1.click          folderbrowserdialog1.selectedpath = environment.getfolderpath(environment.specialfolder.mycomputer) & ""          if (folderbrowserdialog1.showdialog() = dialogresult.ok)                              textbox1.text = folderbrowserdialog1.selectedpath              dim str string = textbox1.text              dim dir match = regex.match(str, "\\([^\\]+)\\")              dim count = textbox1.text.count(function(x) x = "\")                                       textbox2.text = dir.groups(count - 2).tostring                end if      end sub  end class

if understand ask, following code give behavior looking for:

public class form1 private sub button1_click(sender object, e eventargs) handles button1.click     folderbrowserdialog1.selectedpath = environment.getfolderpath(environment.specialfolder.mycomputer)     if (folderbrowserdialog1.showdialog() = dialogresult.ok)         dim strfullpath string = folderbrowserdialog1.selectedpath         textbox1.text = mid(strfullpath, instrrev(strfullpath, "\") + 1)         textbox2.text = strfullpath     end if end sub end class 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -