Bug in Embedded Visual Basic 3.0's 
PictureBox Control


Matthew Kam > CS160 Discussion Sections > VB PictureBox Bug 

 

About the problem of PictureBox controls not displaying bitmaps correctly in VB applications, I've finally found the fix. :) Most of these exact instructions pertain to the emulator for Pocket PC 2002, and you'll need to make slight changes for Pocket PC 2000.

First, look up the BlackJack example under C:\Windows CE Tools\wce300\Pocket PC 2002\samples\evb\Blackjack, and see how they prepend the strPath variable to the .BMP filename. That's how you reference these files by their pathnames correctly. Note that you should be using bitmaps -- I suspect that the PictureBox control doesn't handle GIFs or JPEGs well. Also note that there is a bug which makes VB *not* interpret filenames hardcoded at design time, so you have to set the Picture property at runtime in your program.

Second, for simplicity, make sure that the bitmaps you want to display are located in the same directory as the rest of your .frm files. You want these bitmaps to be copied to the emulator each time you run the program, otherwise it can't locate and load the bitmaps. To do so, you should add the .BMP files as "related documents" to your project. You do this by right-clicking in the "Project" window, selecting "Add | Add File...", checking "Add As Related Document" in the resulting "Add File" dialog box, choosing "All Files (*.*)" from the "Files of type" drop-down box, and selecting the relevant .BMP file(s).

Third, you want to make sure that the PictureBox control is actually installed on the emulator, otherwise your application won't be able to run. In MS Embedded VB, under the "Tools" menu, select "Remote Tools | Control Manager..." Go down the tree until you reach "Pocket PC 2002 Emulation" and click on it. On the right pane, right-click on "Microsoft CE PictureBox Control 3.0" and select "Install to Target."

That should do the trick when running VB applications using the PictureBox control on the emulator. It's a different story trying to get it to work on the actual PDAs.


I can be contacted at mattkam@cs.berkeley.edu  

<< Back to CS160 main page