I'm not that good with VB.Net although I've been working on this program of mine for quite some time and I've learned a great deal since I started. I'm using VS 2010 Professional and .net 4, I've got my program working but I'm trying to add some things that would better inform the user what's going on.
Basically I have the button_click baking up some files from a folder and I'm trying to get the output to show up in a richtext box.
This is what I have so far.
'Obtains the path to the desktop
Desktop = My.Computer.FileSystem.SpecialDirectories.Desktop
'Obtains the username for access to the appdata folder
User = My.Computer.FileSystem.GetParentPath(Desktop)
'Obtains the Systemdrive for backup storage
Drive = My.Computer.FileSystem.GetParentPath( _
My.Computer.FileSystem.GetParentPath(User))
TextBox2.Text = My.Computer.FileSystem.ReadAllText(Drive & "\Test\Test.config")
Dim svr As String
Dim filenames() As String = Directory.GetFiles(Drive & "Test\BackedFiles\Server\")
Dim i As Integer
svr = TextBox2.Text
i = 0
For i = 0 To filenames.Length - 1
output.Text = Path.GetFileName(filenames(i))
output.Refresh()
Next (i)
My.Computer.FileSystem.CopyFile(svr & "\banned-ips.txt", Drive & "BackedFiles\Server\banned-ips.txt", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\banned-players.txt", Drive & "BackedFiles\Server\banned-players.txt", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\ops.txt", Drive & "BackedFiles\Server\ops.txt", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\server.log", Drive & "BackedFiles\Server\server.log", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\server.properties", Drive & "BackedFiles\Server\server.properties", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\white-list.txt", Drive & "BackedFiles\Server\white-list.txt", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\Server.exe", Drive & "BackedFiles\Server\Server.exe", overwrite:=True)
My.Computer.FileSystem.CopyDirectory(svr & "\world\", Drive & "BackedFiles\Server\Wolrd", overwrite:=True)
Right now it's piping the files being backed up to the textbox called "output" but it all happens really fast and it shows them 1 at a time. I was wanting it to place each file backed up on a new line. So that it looks like this;
banned-ips.txt
banned-players.txt
ops.txt
server.log
server.properties
white-list.txt
server.exe
all of them in the output text box. Try not to critique my code too much, as I said I'm a beginner.
Basically I have the button_click baking up some files from a folder and I'm trying to get the output to show up in a richtext box.
This is what I have so far.
'Obtains the path to the desktop
Desktop = My.Computer.FileSystem.SpecialDirectories.Desktop
'Obtains the username for access to the appdata folder
User = My.Computer.FileSystem.GetParentPath(Desktop)
'Obtains the Systemdrive for backup storage
Drive = My.Computer.FileSystem.GetParentPath( _
My.Computer.FileSystem.GetParentPath(User))
TextBox2.Text = My.Computer.FileSystem.ReadAllText(Drive & "\Test\Test.config")
Dim svr As String
Dim filenames() As String = Directory.GetFiles(Drive & "Test\BackedFiles\Server\")
Dim i As Integer
svr = TextBox2.Text
i = 0
For i = 0 To filenames.Length - 1
output.Text = Path.GetFileName(filenames(i))
output.Refresh()
Next (i)
My.Computer.FileSystem.CopyFile(svr & "\banned-ips.txt", Drive & "BackedFiles\Server\banned-ips.txt", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\banned-players.txt", Drive & "BackedFiles\Server\banned-players.txt", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\ops.txt", Drive & "BackedFiles\Server\ops.txt", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\server.log", Drive & "BackedFiles\Server\server.log", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\server.properties", Drive & "BackedFiles\Server\server.properties", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\white-list.txt", Drive & "BackedFiles\Server\white-list.txt", overwrite:=True)
My.Computer.FileSystem.CopyFile(svr & "\Server.exe", Drive & "BackedFiles\Server\Server.exe", overwrite:=True)
My.Computer.FileSystem.CopyDirectory(svr & "\world\", Drive & "BackedFiles\Server\Wolrd", overwrite:=True)
Right now it's piping the files being backed up to the textbox called "output" but it all happens really fast and it shows them 1 at a time. I was wanting it to place each file backed up on a new line. So that it looks like this;
banned-ips.txt
banned-players.txt
ops.txt
server.log
server.properties
white-list.txt
server.exe
all of them in the output text box. Try not to critique my code too much, as I said I'm a beginner.