how to put a Button Image into an array?
-
Hello everyone, I use the following code to place an image "temp.jpeg" into an array and then write the array into a remote database.
int FileSize; byte[] ImageArray; FileStream fs; int iBytesRead; // 1. OpenFileName = "temp.jpeg"; // 2. By using FileStream object, fill the byte array. fs = new FileStream(OpenFileName, FileMode.Open, FileAccess.Read, FileShare.Read); FileSize = Convert.ToInt32(fs.Length); // 3. Declare an array of that size. ImageArray = new byte[FileSize]; iBytesRead = fs.Read(ImageArray, 0, FileSize); fs.Close();
I was wonder what I should do if the image is not a file such as "temp.jpeg" and it is the image displayed in a Button? Can someone be kind enough to help me out on this one? Thank you very much and have a great day. Khoramdin -
Hello everyone, I use the following code to place an image "temp.jpeg" into an array and then write the array into a remote database.
int FileSize; byte[] ImageArray; FileStream fs; int iBytesRead; // 1. OpenFileName = "temp.jpeg"; // 2. By using FileStream object, fill the byte array. fs = new FileStream(OpenFileName, FileMode.Open, FileAccess.Read, FileShare.Read); FileSize = Convert.ToInt32(fs.Length); // 3. Declare an array of that size. ImageArray = new byte[FileSize]; iBytesRead = fs.Read(ImageArray, 0, FileSize); fs.Close();
I was wonder what I should do if the image is not a file such as "temp.jpeg" and it is the image displayed in a Button? Can someone be kind enough to help me out on this one? Thank you very much and have a great day. Khoramdin