[Gambas-user] Problem clearing picture in a PictureBox

Willy Raets willy at ...2734...
Fri Nov 30 16:04:36 CET 2012


Hi,

I've this form with a Panel and in there some TextBoxes, PictureBoxes
and some Buttons.
Button opens a Dialog to browse for PNG files and when selected show use
the Dialog.Path to load the PNG into PictureBox (using PicBox.Picture =
Picture.Load(Dialog.Path))

At a certain moment I want to clear the form and have this little
rountine:

Public Sub PanelClear()

   TextBox1.Clear
   TextBox2.Clear
   PictureBox1.Picture.Clear
   PictureBox2.Picture.Clear
   Me.Refresh

End

TextBoxes clear properly, but PictureBoxes don't.
The loaded PNG stays visible in the PictureBox.

If one of the PictureBoxes has no loaded picture in there on clearing an
error is generated because of it being Null.

1. How do I get the PictureBoxes cleared of the shown picture?
Am I using Clear wrongly? Also tried PictureBox1.Picture.Flush with no
success.

2. How test for a empty PictureBox?
I tried testing with IsNull(PictureBox.Picture), but that doesn't seem
to do the job.

Any suggestions that might get me on the road again?

Running Gambas 3.3.4 on Linux Mint 13 - Mate desktop
Using gb.qt4 in the project.

Willy







More information about the User mailing list