D
DRAT
Guest
I would like to embedd images into my exe in visual basic.net
If I cant figure out how to do this then how can I reference the directory from which my executable was run, so that I can access images in the game folder?
Embedding-
I tried to add existing object, browse to image, then after its added to the project, go to its properties and set "build action" to "embedded resource." Then, according to two tutorials I found I just need to import system.resources and use the following code to access the images from the resources file-
Dim rm As New ResourceManager("Chess.form1", Me.GetType().Assembly)
button1.image = CType(rm.GetObject("1234.bmp"), System.Drawing.Image)
One tutorial said to reference the image as 1234_bmp rather than 1234.bmp but either way it references nothing. It doesnt error but no image appears on the button and the image.height returns null. The chess.form1.resources file Im attempting to access is found in the obj\debug dir. That is the only .resources file I could find.
If you could please tell me how to embedd images or at least how to access files relative to the path of the executable wi oudl papreciate it. Keep in mind that this is Visual Basic.net
Thx
Daniel
If I cant figure out how to do this then how can I reference the directory from which my executable was run, so that I can access images in the game folder?
Embedding-
I tried to add existing object, browse to image, then after its added to the project, go to its properties and set "build action" to "embedded resource." Then, according to two tutorials I found I just need to import system.resources and use the following code to access the images from the resources file-
Dim rm As New ResourceManager("Chess.form1", Me.GetType().Assembly)
button1.image = CType(rm.GetObject("1234.bmp"), System.Drawing.Image)
One tutorial said to reference the image as 1234_bmp rather than 1234.bmp but either way it references nothing. It doesnt error but no image appears on the button and the image.height returns null. The chess.form1.resources file Im attempting to access is found in the obj\debug dir. That is the only .resources file I could find.
If you could please tell me how to embedd images or at least how to access files relative to the path of the executable wi oudl papreciate it. Keep in mind that this is Visual Basic.net
Thx
Daniel