displaying bmp in PictureBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am jumping into the compact framework for the first time and I am getting a
strange message in the Output window when trying to load a bmp into a
PictureBox. The bmp does display but the message I receive is, 'A first
chance exception of type 'System.InvalidCastException' occurred in
System.Drawing.dll'.

It occurs using VS2005 and deploying on the PocketPC emulator. It does not
occur when I do the same thing using VS2003 and the emulator.

The simple code is,
Dim myPic As Bitmap

'Form1.imagePath is a Static string which is filled when the user
selects a .bmp from a listbox
'the imagePath is "\windows\bt_help.bmp"
Try
myPic = New Bitmap(Form1.imagePath)
picImage.Image = myPic
Catch ex As Exception
Console.WriteLine("Error getting image. " + ex.Message)
End Try
 
Please provide more info.

VS.NET 2003 which emulator and what CF Service Pack?

VS2005 which emulator and what CF version?

Even if you get the exact same versions of framework and emulator, one is
arm and the other is x86. Best way to test these things is with a real
device.

Cheers
Daniel
 
Back
Top