visual studio - Trying to Create a Extractor program in VB.net -


so i'm trying create program game take mods in .zip form folder , extract them in game folder, code i've got far. think code of button2 can't folder's other button's have tried several things cant work.

imports system.io.compression imports system.io  public class form1  dim gamefolder string dim zipfolder string   private sub button1_click(sender object, e eventargs) handles button1.click     close() end sub  public sub button2_click(sender object, e eventargs) handles button2.click      dim mypath string     dim fname string      mypath = zipfolder  ' select zip location folder     fname = dir(mypath & "*.zip")  ' first zip file     while len(fname) > 0         zipfile.extracttodirectory(fname, mypath)         fname = dir()   ' next matching file     loop end sub  public sub button3_click(sender object, e eventargs) handles button3.click     dim fd folderbrowserdialog = new folderbrowserdialog() ' let user select zip folder     dim zipfolder string     if fd.showdialog() = dialogresult.ok         zipfolder = fd.selectedpath 'set zipfolder string output of folderbrowser     end if end sub  public sub button4_click(sender object, e eventargs) handles button4.click     dim fd folderbrowserdialog = new folderbrowserdialog() 'let user select game folder     dim gamefolder string     if fd.showdialog() = dialogresult.ok         gamefolder = fd.selectedpath 'set gamefolder string output of folderbrowser     end if end sub  end class 

apart initial declarations @ top of code,

remove other occurrences of

dim gamefolder string dim zipfolder string 

the reason when declare them in subs, code in sub use local declaration in preference global one.

so, when assign dialog results variables in current code, assigned local variables, not form wide variables.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -