Keep in mind the scope of the iHeader Image control. Since you explicitely
create it in the Page_Init event, that's the only place you can reference it
directly as it's not a global or class variable. If you defined it as part
of the class you could then reference it without problem anywhere within the
class.
When you access it from a subroutine, you can use the Page.FindControl
method to attempt to find the control named "iHeader". You'll create a local
variable as a reference to it within your iHeader_Init code. You'll have to
forgive me, but I haven't used VB.Net in years so I'm going to supply the C#
equivalent
System.Web.UI.WebControls.Image iHeader =
(System.Web.UI.WebControls.Image)Page.FindControl( "iHeader");
if(iHeader != null)
{
// then you can manipulate the iHeader reference here since it found
the control OK.
}
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"shapper" <md*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hello,
I my Page_Init event I have the following:
Dim iHeader As New Image
AddHandler iHeader.Init, AddressOf iHeader_Init
Page.Controls.Add(iHeader)
Then I have this:
Private Sub iHeader_Init(ByVal sender As Object, ByVal e As
EventArgs)
' Define iHeader properties
With iHeader ************************* ERROR
***************************
.AlternateText =
Me.GetLocalResourceObject("iHeader.AlternateText")
.ImageAlign = ImageAlign.Top
.ImageUrl = "~/Assets_Design/Images/Header_Drawing.jpg"
.ToolTip = Me.GetLocalResourceObject("iHeader.ToolTip")
End With
End Sub
I am getting the error "iHeader is no declared" in ****************.
How can I do this?
Thanks,
Miguel