Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
QuestionC# javascript communication Pin
tashee11-Dec-12 2:12
tashee11-Dec-12 2:12 
AnswerRe: C# javascript communication Pin
V.11-Dec-12 3:40
professionalV.11-Dec-12 3:40 
QuestionWCF Services in a multi threaded application results in Oracle Connection request Timed out error Pin
rajaron11-Dec-12 0:16
rajaron11-Dec-12 0:16 
Questionimage from access database in c# Pin
kojoam110-Dec-12 4:10
kojoam110-Dec-12 4:10 
QuestionRe: image from access database in c# Pin
Richard MacCutchan10-Dec-12 21:29
mveRichard MacCutchan10-Dec-12 21:29 
AnswerRe: image from access database in c# Pin
Pete O'Hanlon10-Dec-12 22:15
mvePete O'Hanlon10-Dec-12 22:15 
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 

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.