A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

[Vb.net] Droppping a resource.

912 views · started by Bman ·
#1
[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.

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
 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.

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.

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.

TempFile.Close() 


That closes the temporary file thus finalizing the byte writing ;)


Enjoy :)
#2
So this can make a specific size program?
Im confused on how to use this