On an aspx page with C# code behind I am trying to programmaticall y change
the ImageUrl of various ImageButtons in response to the text contained in
corresponding label controls.
The following code works:
PropertyDescrip torCollection properties =
TypeDescriptor. GetProperties(t his.ImageButton 12);
PropertyDescrip tor myProperty = properties.Find ("ImageUrl", false);
myProperty.SetV alue(ImageButto n12,@"C:\Inetpu b\wwwroot\BB\im ages\X.BMP")
Now I want to replace all references to "ImageButto n12" in the above code
with a member of an array such as "pram[2]" so that I can loop through all
the ImageBoxes easily in code.
Where:
string[] pram = new string[]
{"Label33","Lab el34","Label35" ,"Label36","Lab el37","Label38" ,"Label39"};
or
string[] pram = new string[] {"this.Label33" ,"this.Label34" ,"this.Label35" ,"
this.Label36"," this.Label37"," this.label38"," this.Label39"};
or
Object[] pram = new Object[]
{"this.Label33" ,"this.Label34" ,"Label35","Lab el36","Label37" ,"Label38","Lab el39"};
Each time a get an "Object reference not set to an instance of an object"
error.
I have even tried changing the array to a component array, but then I get a
"Can't implicitly change type" error.
The data type specified is "object component" I need to build an array of
object components that I can address by index number.
Any insight would be appreciated.
Thanks,
Jim 1 1085
Although I'm more a VB programmer, I think I know the answer:
(correct me if I'm wrong)
in the line :
myProperty.SetV alue(ImageButto n12,@"C:\Inetpu b\wwwroot\BB\im ages\X.BMP")
ImageButton12 is a object, in this case a button.
What you are trying to do is to replace a button-object with a string.
The setvalue method then does not recognize it as an object and gives an
error.
rg.
Eric
"Jim McGivney" <mc****@no-spam.sbcglobal. net> schreef in bericht
news:u6******** ********@tk2msf tngp13.phx.gbl. .. On an aspx page with C# code behind I am trying to programmaticall y change the ImageUrl of various ImageButtons in response to the text contained in corresponding label controls. The following code works: PropertyDescrip torCollection properties = TypeDescriptor. GetProperties(t his.ImageButton 12); PropertyDescrip tor myProperty = properties.Find ("ImageUrl", false); myProperty.SetV alue(ImageButto n12,@"C:\Inetpu b\wwwroot\BB\im ages\X.BMP")
Now I want to replace all references to "ImageButto n12" in the above code with a member of an array such as "pram[2]" so that I can loop through all the ImageBoxes easily in code. Where: string[] pram = new string[] {"Label33","Lab el34","Label35" ,"Label36","Lab el37","Label38" ,"Label39"}; or string[] pram = new string[] {"this.Label33" ,"this.Label34" ,"this.Label35" ," this.Label36"," this.Label37"," this.label38"," this.Label39"}; or Object[] pram = new Object[] {"this.Label33" ,"this.Label34" ,"Label35","Lab el36","Label37" ,"Label38","Lab el39"};
Each time a get an "Object reference not set to an instance of an object" error. I have even tried changing the array to a component array, but then I get a "Can't implicitly change type" error. The data type specified is "object component" I need to build an array of object components that I can address by index number. Any insight would be appreciated.
Thanks,
Jim
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ian |
last post by:
The beginning of my assembly that I am getting the access error from looks
like this.
*********************************
Imports System.EnterpriseServices
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Data.Common
Imports System.Reflection
|
by: brazilnut52 |
last post by:
I am going to outline the steps I go through to produce the problem. Hopefully this will help you understand the problem better
I have created a simple COM DLL in .NET by using the COM class template and by setting output to a type library (DLL). All the object does is return a string value. At this point I have not checked the option to register for COM interop in Visual Studio
So I go into Excel (where I want to use the object). Go to VB...
|
by: gulu man |
last post by:
Hi,
What is the substitute for COM objects in .NET?
How can I create something similar to com in .net?
Is it still possible?
Thank you
|
by: Pexi |
last post by:
Hi,
we have a component developed with VB6 (compiled as a single threaded dll),
which we have used as Application level object for several years in classic
asp without problems. Yet now, when we are trying to use this same component
in Win2003 + IIS6 environment, we get following error:
-----------
Application object, ASP 0197 (0x80004005)
Cannot add object with apartment model behavior to the application intrinsic
object.
|
by: Andrus |
last post by:
I'm implementing entity object which should populate its properties from
database when property is first referenced.
In RDL reports I use object properties like
MyObject.MyProperty
MyObject is instance of MyEntity class. There is no MyProperty property in
MyObject at design time.
| |
by: gary.bernstein |
last post by:
I want to call a singleton getInstance function to retrieve a
templatized object without knowing what types were used to create the
singleton object in the first call to getInstance. How can I do this
non-intrusively -- I.e., without, for example, typedef'ing the types
in every compilation unit?
Background:
Our code base has assert macros that need to reboot the system after
notifying components via a single templatized Component...
|
by: Stephen Torri |
last post by:
Here is my attempt at implementing a object factory. The purpose of this
is to replace a large switch statement in a factory class with the
functors. I get an error at line 88, marked, "expected primary-expression
before ')' token". I am using Modern C++ Design chapter 8 as a guide.
Stephen
---------------------
#include <map>
|
by: =?Utf-8?B?VmVua2F0ZXNhbiBT?= |
last post by:
Hi,
I have a requirement of consuming a connection object returned from a COM
component deployed in COM+ application. I have given the need for this
requirement end of my query.
My component returns a Connection objec to ASP page and then I am trying to
use the same Connection object to Command/Recordset object to execute a SP
I am getting the error given below
************************************
|
by: colin |
last post by:
Hi,
Im a bit confused about when you cast a value type to an object.
I have a property grid wich stores the data and the defualt as
objects.
the data is limited to primitive types, structs and strings.
the structs only have primitive types.
however once ive set the data to the defualt,
if the data is a struct then any edits change the defualt data as well
|
by: dream party |
last post by:
Inserting a Flash (SWF, FLV) file into HTML web page is already an old and familiar thing to all of us. It is a rather non-flexible thing that just to edit some options in the template. However, I did not understand some parameters totally in the HTML tag. These days when I was surfing the Internet I have found some comprehensive introduction to these two tags. I read it and conclude it with my own words; I think it will be useful to us, so I...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |