![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Simple question, (sorry if this has already been covered - couldn't find it.) - why does a newly loaded image not show, but is OK if passed to another button?
I have a row of 5 ImageButtons, with no images at the start. They will all shown the same picture: button-1 is loaded from an SQL BLOB and the others are set from the 1st one. Button-1 does not show the picture, only a red cross. The other 4 buttons show the image correctly. The code is:- cmd.CommandText = "SELECT * FROM FileStore WHERE Name = 'camera_pic'" reader.Value = cmd.ExecuteReader reader.ReadNextRow btnPic1.Image = reader.GetImage(2) reader.Close btnPic2.Image = btnPic1.Image btnPic3.Image = btnPic1.Image btnPic4.Image = btnPic1.Image btnPic5.Image = btnPic1.Image Easy workaround is to add "btnPic1.Image = btnPic2.Image" at the end, but why does it not show the first time? If I replace the first button by an Image control, it shows perfectly. It's no big deal, but curious! Am I doing something wrong? Geoff. |
|
|||
|
Yes, button-1 shows as before - just a a red cross (no text either), while of course the other buttons just correctly show the text only.
The other buttons also show as a red cross, if I load them directly. reader.ReadNextRow btnPic1.Image = reader.GetImage(2) ' load image into button btnPic2.Image = reader.GetImage(2) ' load image into button reader.Close Interestingly, if I first load into an ImageList control, it makes no difference and buttons still show as a red cross. Whereas if an invisible Image control is used first, everything works fine. Also OK if an Image control is loaded from the ImageList, like this:- reader.ReadNextRow ilPMv.Add(reader.GetImage(2)) reader.Close btnPic1.Image = ilPMv.Item(0) ' no good - red cross imgTest.Image = ilPMv.Item(0) ' works fine BTW I'm running 5.80 Geoff. |
|
|||
|
Thanks Erel and Robert. Very helpful explanation of the behaviour. Unchecking Tranparent does indeed allow the image to display - not something I had thought of and a very useful tip for the future. In this particular example, Transparent is used intentionally so the workaround of re-assigning the image gives an effective result.
![]() Geoff. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AddEvent & ImageButton in IDE | agraham | Bug Reports | 1 | 09-10-2008 09:31 PM |
| Copy Record from one database to another database. | mozaharul | Questions & Help Needed | 0 | 07-15-2008 05:47 AM |
| ImageButton MouseOver | superbabicka | Questions & Help Needed | 0 | 06-29-2008 09:19 PM |
| Problem: fetch and store image to/from database | willisgt | Questions & Help Needed | 2 | 05-13-2008 04:10 PM |
| How to convert an Access database to a sqlite database | Peter | Code Samples & Tips | 5 | 07-24-2007 04:20 PM |