Click here to Skip to main content
15,912,756 members
Home / Discussions / C#
   

C#

 
GeneralRe: image from access database in c# Pin
Richard MacCutchan10-Dec-12 22:40
mveRichard MacCutchan10-Dec-12 22:40 
AnswerRe: image from access database in c# Pin
Pete O'Hanlon11-Dec-12 0:08
mvePete O'Hanlon11-Dec-12 0:08 
Richard's right. Add a breakpoint on the if statement. To do this, you can click on the line and press F9 (this is the shortcut to toggle the breakpoint on and off). You should see a red dot appear in the gutter in Visual Studio. Press F5 to run your application. When you hit the if statement, press F10 to step over the code. If you do this you will find out if this value is null or not.

Now, one thing I would do is wrap the MemoryStream in a using statement. A MemoryStream is a disposable object, so you should always dispose of it. This would give you:
C#
using (MemoryStream ms = new MemoryStream(photo_array))
{
  picBox1.Image = Image.FromStream(ms);
}
Your code will now dispose of the stream.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

Questionsave bitmap in C# Pin
gibsray10-Dec-12 0:55
gibsray10-Dec-12 0:55 
AnswerRe: save bitmap in C# Pin
Pete O'Hanlon10-Dec-12 1:14
mvePete O'Hanlon10-Dec-12 1:14 
AnswerRe: save bitmap in C# Pin
OriginalGriff10-Dec-12 1:26
mveOriginalGriff10-Dec-12 1:26 
QuestionC# Pin
Half Blood Prince9-Dec-12 22:32
Half Blood Prince9-Dec-12 22:32 
AnswerRe: C# Pin
J4amieC9-Dec-12 23:03
J4amieC9-Dec-12 23:03 
AnswerRe: C# Pin
Keith Barrow9-Dec-12 23:35
professionalKeith Barrow9-Dec-12 23:35 
AnswerRe: C# Pin
Dave Kreskowiak10-Dec-12 2:19
mveDave Kreskowiak10-Dec-12 2:19 
AnswerRe: C# Pin
Abhinav S10-Dec-12 19:57
Abhinav S10-Dec-12 19:57 
Questionhi Pin
vijayalakshmi h9-Dec-12 22:30
vijayalakshmi h9-Dec-12 22:30 
AnswerRe: hi Pin
Pete O'Hanlon9-Dec-12 22:35
mvePete O'Hanlon9-Dec-12 22:35 
AnswerRe: hi Pin
J4amieC9-Dec-12 23:02
J4amieC9-Dec-12 23:02 
GeneralRe: hi Pin
Jibesh10-Dec-12 8:56
professionalJibesh10-Dec-12 8:56 
AnswerRe: hi Pin
Keith Barrow9-Dec-12 23:36
professionalKeith Barrow9-Dec-12 23:36 
AnswerRe: hi Pin
V.10-Dec-12 1:37
professionalV.10-Dec-12 1:37 
GeneralRe: hi Pin
Dave Kreskowiak10-Dec-12 2:18
mveDave Kreskowiak10-Dec-12 2:18 
AnswerRe: hi Pin
Abhinav S10-Dec-12 19:57
Abhinav S10-Dec-12 19:57 
Questionhi Pin
Sowmiya ravi9-Dec-12 22:22
Sowmiya ravi9-Dec-12 22:22 
AnswerRe: hi Pin
J4amieC9-Dec-12 23:02
J4amieC9-Dec-12 23:02 
AnswerRe: hi Pin
Keith Barrow9-Dec-12 23:37
professionalKeith Barrow9-Dec-12 23:37 
Questionasp.net and c# login and register page Pin
Member 80648029-Dec-12 21:46
Member 80648029-Dec-12 21:46 
AnswerRe: asp.net and c# login and register page Pin
Vaibhav Kharejoshi9-Dec-12 22:35
Vaibhav Kharejoshi9-Dec-12 22:35 
Questionthe use of Lambda and action delegate Pin
Tridip Bhattacharjee9-Dec-12 21:17
professionalTridip Bhattacharjee9-Dec-12 21:17 
AnswerRe: the use of Lambda and action delegate Pin
Eddy Vluggen9-Dec-12 23:04
professionalEddy Vluggen9-Dec-12 23:04 

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.