[Vb.net] Droppping a resource.
In this tutorial i will show you how to drop a resource when you click a button.
First.. Add the resource to the project you would like to later drop.
Put a button on the form.
Now comes the coding.
PHP Code:
Dim b As Byte() = My.Resources. Your resource name
What this does is dims b, as a byte, from the resource you specified.
Then i want you to add this
PHP Code:
Dim FilePath As String = Application.StartupPath & "\The file name & extension you want"
That dims a file path as the application startup path and the name you want. Thus leading us to the next step.
PHP Code:
Dim TempFile As System.IO.FileStream = IO.File.Create(FilePath)
This creates a temp file at the file path you specified. Which will allow us to right the bytes to it.
PHP Code:
TempFile.Write(b, 0, b.Length)
That is the main part of the program... It writes the bytes from your resource, to your tempfile. So it will actually work.
PHP Code:
TempFile.Close()
That closes the temporary file thus finalizing the byte writing ;)
Enjoy :)