[Gambas-user] Picture Viewer Project

Michael Sullivan michael at ...558...
Mon Mar 14 21:19:19 CET 2005


I've gotten past the Null Object error.  Here is my code:

PUBLIC SUB fileList_Select()
  DIM hPic AS Picture 
  DIM tempPic AS String 
 
  tempPic = myDir & "/" & Str(fileList.Current)     
  hPic = NEW Picture
  hPic.Load(tempPic)
  
  MyPicture.Picture = hPic  

END

But whenever I pick any picture filename I get the error "Unable to load
picture".  The documentation says that the PictureBox control can load
jpegs.  The picture I tried it on was a jpg.  Does that make a
difference?  What am I doing wrong?

On Mon, 2005-03-14 at 14:05 -0600, Michael Sullivan wrote:
> I misunderstood.  You meant a Picture.  I thought you meant a
> PictureBox.  I created a Picture object and then assigned my Path As
> String to it, but it keeps telling me that the Picture Object is null.
> How to I get it to access my Picture?  Here is the code as it now
> stands.  MyPicture is the PictureBox on the form:
> 
> PUBLIC SUB fileList_Select()
>   DIM hPic AS Picture 
>   DIM tempPic AS String 
>  
>   tempPic = myDir & "/" & Str(fileList.Current)     
>   hPic = NEW Picture() 
>   hPic.Load(tempPic)
>   
>   MyPicture.Picture = hPic  
> 
> END
> 
> 
> On Mon, 2005-03-14 at 13:53 -0600, Michael Sullivan wrote:
> > PUBLIC SUB fileList_Select()
> > 
> >   DIM tempPic AS String 
> >  
> >   tempPic = myDir & "/" & Str(fileList.Current)     
> >   
> >   
> >   MyPicture.Load(tempPic)
> >   
> > 
> > END
> > 
> > 
> > It gives me an "Unknown symbol 'Load' in class 'PictureBox'" message
> > when I use this.  myDir is a public String...
> > 
> > On Mon, 2005-03-14 at 19:36 +0100, Bodard Fabien wrote:
> > > Le lundi 14 Mars 2005 16:03, Michael Sullivan a écrit :
> > > > I'm working on a small Picture Viewer project.  The form consists of a
> > > > large PictureBox and a listbox that lists files from a directory.  I
> > > > want the PictureBox to show the picture the user selects from the
> > > > fileList, but I can't figure out how to do it.  When the user selects a
> > > > filename from the list box, that filename is assigned to a string.  Can
> > > > anyone give me the exact syntax for loading a picture file from a string
> > > > filename?  I looking in the docs; they mentioned a Load subroutine, but
> > > > I can't figure out how to use it...
> > > 
> > > 
> > > MyPicture.Load("path")
> > > 
> > > 
> > > 
> > > > -------------------------------------------------------
> > > > SF email is sponsored by - The IT Product Guide
> > > > Read honest & candid reviews on hundreds of IT Products from real users.
> > > > Discover which products truly live up to the hype. Start reading now.
> > > > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > > > _______________________________________________
> > > > Gambas-user mailing list
> > > > Gambas-user at lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > 
> > > 
> > > 
> > > -------------------------------------------------------
> > > SF email is sponsored by - The IT Product Guide
> > > Read honest & candid reviews on hundreds of IT Products from real users.
> > > Discover which products truly live up to the hype. Start reading now.
> > > http://ads.osdn.com/?ad_ide95&alloc_id396&opÌk
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > 
> > 
> > 
> > 
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real users.
> > Discover which products truly live up to the hype. Start reading now.
> > http://ads.osdn.com/?ad_ide95&alloc_id396&opÌk
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > 





More information about the User mailing list