Click here to Skip to main content
15,890,336 members
Home / Discussions / C#
   

C#

 
AnswerRe: Adding data from dataGridView to arrayList Pin
albCode28-Dec-05 3:52
albCode28-Dec-05 3:52 
GeneralRe: Adding data from dataGridView to arrayList Pin
Duif28-Dec-05 4:15
Duif28-Dec-05 4:15 
GeneralRe: Adding data from dataGridView to arrayList Pin
albCode28-Dec-05 4:39
albCode28-Dec-05 4:39 
QuestionEvents Pin
nunom_c28-Dec-05 3:03
nunom_c28-Dec-05 3:03 
AnswerRe: Events Pin
albCode28-Dec-05 3:31
albCode28-Dec-05 3:31 
AnswerRe: Events Pin
VPMahank28-Dec-05 5:24
VPMahank28-Dec-05 5:24 
QuestionHow can I create a binary buffer of an image from a file? Pin
thomasa28-Dec-05 2:46
thomasa28-Dec-05 2:46 
AnswerRe: How can I create a binary buffer of an image from a file? Pin
Judah Gabriel Himango28-Dec-05 4:27
sponsorJudah Gabriel Himango28-Dec-05 4:27 
Try flushing the file stream (and also, you MUST dispose the FileStream as well). Setting it to null is pointless; you only need to do that in Java.

private byte[] getImageBytes()
{
   byte[] buffer = new byte[templateStream.Length];
   
   using(FileStream templateStream = File.Open(@"C:\MyImage.gif", FileMode.Open))
   {
      templateStream.Write(buffer, 0, (int)templateStream.Length);
      templateStream.Flush();
   }
   return buffer;
}


Please note that if you're using the latest version of the .NET framework, you can use the File.ReadAllBytes method, which is more efficient and requires only a single line of code:

private byte[] getImageBytes()
{
   return File.ReadAllBytes(@"c:\MyImage.gif");
}


Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango


GeneralRe: How can I create a binary buffer of an image from a file? Pin
leppie28-Dec-05 6:49
leppie28-Dec-05 6:49 
GeneralRe: How can I create a binary buffer of an image from a file? Pin
Judah Gabriel Himango28-Dec-05 7:09
sponsorJudah Gabriel Himango28-Dec-05 7:09 
GeneralRe: How can I create a binary buffer of an image from a file? Pin
S. Senthil Kumar28-Dec-05 19:31
S. Senthil Kumar28-Dec-05 19:31 
GeneralRe: How can I create a binary buffer of an image from a file? Pin
Judah Gabriel Himango29-Dec-05 4:13
sponsorJudah Gabriel Himango29-Dec-05 4:13 
GeneralRe: How can I create a binary buffer of an image from a file? Pin
thomasa28-Dec-05 22:04
thomasa28-Dec-05 22:04 
AnswerRe: How can I create a binary buffer of an image from a file? Pin
leppie28-Dec-05 6:51
leppie28-Dec-05 6:51 
AnswerRe: How can I create a binary buffer of an image from a file? Pin
Dave Kreskowiak28-Dec-05 8:08
mveDave Kreskowiak28-Dec-05 8:08 
QuestionIm having a problem with this Icon class Pin
imsathy28-Dec-05 2:15
imsathy28-Dec-05 2:15 
AnswerRe: Im having a problem with this Icon class Pin
Robert Rohde28-Dec-05 5:45
Robert Rohde28-Dec-05 5:45 
GeneralRe: Im having a problem with this Icon class Pin
imsathy28-Dec-05 18:57
imsathy28-Dec-05 18:57 
QuestionDataBind Issue Pin
HolyGrandFather28-Dec-05 1:57
HolyGrandFather28-Dec-05 1:57 
AnswerRe: DataBind Issue Pin
albCode28-Dec-05 2:35
albCode28-Dec-05 2:35 
GeneralRe: DataBind Issue NO LUCK Pin
HolyGrandFather28-Dec-05 3:05
HolyGrandFather28-Dec-05 3:05 
GeneralRe: DataBind Issue NO LUCK Pin
albCode28-Dec-05 3:35
albCode28-Dec-05 3:35 
QuestionHow to disable close and resize button in c#.net application Pin
Malayil alex28-Dec-05 0:41
Malayil alex28-Dec-05 0:41 
AnswerRe: How to disable close and resize button in c#.net application Pin
albCode28-Dec-05 0:54
albCode28-Dec-05 0:54 
AnswerRe: How to disable close and resize button in c#.net application Pin
Luis Alonso Ramos28-Dec-05 5:56
Luis Alonso Ramos28-Dec-05 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.