How do I dynamically create an image on my form?

  • Thread starter Robson Carvalho Machado
  • Start date
R

Robson Carvalho Machado

Dear friends,

Does anybody can help me with dynamically creation of an image on my form?
I'm using the following code to create an ImageButom but it does not work
with single Image.

What do I need to do?

Dim myImageButton as ImageButton
myImageButton = New ImageButton
myImageButton.ID = "ImageButton1"
myImageButton.ImageUrl = "http://localhost/img.gif"
PlaceHolder1.Controls.Add(myImageButton)

When I try the following code it does not work:

Dim myImage as Image
myImage = New Image
myImage.ID = "Image1"
myImage.ImageUrl = "http://localhost/img.gif"
PlaceHolder1.Controls.Add(myImage)
 
R

Robson Carvalho Machado

Dear friends,

A friend on this communit has already answered my question.

SOLUTION
-------------
Dim myImage as WebControls.Image
myImage = New WebControls.Image
myImage.ImageUrl = ImageUrl
myImg.Width = Unit.Pixel(100)
img.Height = Unit.Pixel(100)
PlaceHolder1.Controls.Add(myImage)
 

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

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top