Originally posted by mrdj1002
I wanted to see how to convert a picture variable into byte array and reverce....
You can get a bit array from a picture object using the GetBimapBits API. Instead of passing to the function a long handle to a bitmap object, pass you picture object instead. Also, you can use the GetObject (api,not vb getobject function) function to get the information of the bitmap. This will help you resize your array to receive the bitmap bits. If you modify this array, you can change the bits of you picture to the one from your array by using SetBitmapBits.

To create a picture object from an array of bytes, you have to first create a compatible bitmap, then set it's bits using SetBitmapBits and then use the OleCreatePictureIndirect function to put this bitmap into the picture object.

note: for information about the API calls i've talked about, go check out allapi.net
can i do it with jpg files too? and can i save a picture in picturebox into a jpeg file
The vb LoadPicture function support .jpg files so you could load a jpeg and retreive a bit array from the picture it was loaded in. However this is only for loading and the picture box control can only save bitmap files. If you want to save jpegs, you will need to download an activex or a dll, I think that intel(?) has a free dll that you can download from the net.

Good luck

- Valkan