By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,852 Members | 2,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,852 IT Pros & Developers. It's quick & easy.

Webusercontrol, Image is nothing -- why?

P: n/a
I have a webusercontrol with several controls on it, including an image
control.

I've coded a public sub "Display" which puts an image in the Image control.

The problem is, when I call Display, the Image control is nothing. Why?
In fact, when I get to this point, all the controls (lblPrice, etc.) are
nothing.. Why?

Here's some code:

Public Sub Display()
'refresh controls, show picture and text
Try
DisplayImageBytes(m_Image, Image1, "Package1")
lblContents.Text = m_Contents
lblPrice.Text = m_Price.ToString("{0:c}")
Catch ex As Exception
End Try
End Sub

When this executes (it gets called from the parent form which contains the
usercontrol) it gives me an error because it says Image1 is nothing.

What's going on?

Thanks!
---Selden McCabe
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The Image control must point to a URL.
It doesn't have to point to a JPG or GIF, it can point to an ASPX.
Within THAT ASPX is there you should generate the image.
Here's more info:
http://SteveOrr.net/articles/EasyUploads.aspx
http://www.aspnetpro.com/features/20...200412so_f.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Selden McCabe" <se*****@msn.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
I have a webusercontrol with several controls on it, including an image
control.

I've coded a public sub "Display" which puts an image in the Image
control.

The problem is, when I call Display, the Image control is nothing. Why?
In fact, when I get to this point, all the controls (lblPrice, etc.) are
nothing.. Why?

Here's some code:

Public Sub Display()
'refresh controls, show picture and text
Try
DisplayImageBytes(m_Image, Image1, "Package1")
lblContents.Text = m_Contents
lblPrice.Text = m_Price.ToString("{0:c}")
Catch ex As Exception
End Try
End Sub

When this executes (it gets called from the parent form which contains the
usercontrol) it gives me an error because it says Image1 is nothing.

What's going on?

Thanks!
---Selden McCabe

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.