Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

convert picturebox.resourse to byte[] Array to send it to database WPF

$
0
0
i need help in converting image(picturebox.resourse) to byte array (byte[]) in WPF
id used this code : but it cannot resolve second line 
"Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);"
my code is :
MemoryStream ms = new MemoryStream();
picturebox.Resources.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] pic_arr = new byte[ms.Length];
ms.Position = 0;
ms.Read(pic_arr, 0, pic_arr.Length);
 

Please If You can help me I would be grateful.

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>