473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to access an image

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

Nov 3 '06 #1
2 1547
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

Nov 3 '06 #2
Hi,

Got it! Thanks!

And does it make any sense to keep:
ByVal sender As Object, ByVal e As EventArgs

in
Private Sub iHeader_Init(ByVal sender As Object, ByVal e As EventArgs)

I am asking this because this is the first time I am adding my controls
to the page at runtime.

Thanks,
Miguel

Mark Fitzpatrick wrote:
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
Nov 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
3
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
6
by: Larry R Harrison Jr | last post by:
I have Access XP, and the following code which is supposed to assign a JPEG to an image control: Me.Image9.Picture = "F:\Pictures\CP775_SonyDSCP50\FingerRockNight_Resize.jpg" I get this error...
8
by: Jerry | last post by:
I have an off-the-shelf app that uses an Access database as its backend. One of the tables contains a field with an "OLE Object" datatype. I'm writing some reports against this database, and I...
1
by: Eric Keung | last post by:
Hi all, my case is I want to get an image from access database and I just know it's "OLE object" field type at access I also don't know how to insert it into access here is my code and it just...
13
by: Neo Geshel | last post by:
I have examined about 80+ different upload scripts on the 'net, both in VB and C#, and none seem to do what I need them to do. Perhaps someone here can point me somewhere that Google hasn't...
3
by: Alan | last post by:
Hi, I'm converting a database application from Access 97 to C#/SQL Server. Old database contains some images in OLE fields. I've figured out that there's OLE header preceeding actual image data...
1
by: gm | last post by:
Hi; I have written a database that tracks all the installation we have ever done. I have a small heating company. I have recently started keeping a directory of digital photographs of the...
7
by: needin4mation | last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003. Whenever I link an image all it shows is the filename. Not the image. Other versions of Access can link the image just fine. ...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.