Controls at run time

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

Guest

If I create several controls (images) at run time, how can I handle the click
event of this controls.

Thanks in advance,

Luis Mendes
 
If I create several controls (images) at run time, how can I handle the
click
event of this controls.

Use the AddHandler statement:

AddHandler TheObject.TheEvent, AddressOf TheProcedureToHandleEvent

HTH
 
Thanks for your sugestion.

I can deal with that if I know the number of images to create.

Let me explain better:

I wanto to scan a folder and present the images of that folder in panel (I
just know the number of images at run time).
When the user click's one of this images I need to know with was selected
in order to open a new form with this image.

Thanks in advance

Luis
 
I wanto to scan a folder and present the images of that folder in panel (I
just know the number of images at run time).
When the user click's one of this images I need to know with was selected
in order to open a new form with this image.

It sounds like you want to show thumbnails of images and then allow the user
to click on a thumbnail to see a large image. Is that correct?

If it is then consider using a ListView.

At run time add your images to an ImageList and use that ImageList for the
LargeImageList property of the ListView. The you can add items to the
ListView during runtime setting each item's image index to be one of the
indexes in the image list.

Then you can use the SelectedIndexChanged event to see when a user has
clicked on a thumbnail.

HTH
 
Thanks.

elziko said:
It sounds like you want to show thumbnails of images and then allow the user
to click on a thumbnail to see a large image. Is that correct?

If it is then consider using a ListView.

At run time add your images to an ImageList and use that ImageList for the
LargeImageList property of the ListView. The you can add items to the
ListView during runtime setting each item's image index to be one of the
indexes in the image list.

Then you can use the SelectedIndexChanged event to see when a user has
clicked on a thumbnail.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top