473,387 Members | 1,510 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,387 software developers and data experts.

Reference a component at runtime

I have created a component that I add to the component tray at Design time.
I need to know how to access a property on this component at Runtime. From
what I understand I should use Reflection to do this, but I have never used
Reflection and not sure where to begin.... Could somebody point me in the
right direction?
Nov 21 '05 #1
3 1182

You do not need Reflection to access a component's properties. When you
dropped it onto the component tray it was given a name. Let's say it was
named Componet1. If the property is named Text then to access the property
in code you would type ...

Componet1.Text

Have fun

Robby
"cOdEmOnKeY" <cO********@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
I have created a component that I add to the component tray at Design time.
I need to know how to access a property on this component at Runtime.
From
what I understand I should use Reflection to do this, but I have never
used
Reflection and not sure where to begin.... Could somebody point me in the
right direction?

Nov 21 '05 #2
You are right... I don't know what I was thinking! DOH!
Its been a long day... I am going home.

Thanks

"Robby" wrote:

You do not need Reflection to access a component's properties. When you
dropped it onto the component tray it was given a name. Let's say it was
named Componet1. If the property is named Text then to access the property
in code you would type ...

Componet1.Text

Have fun

Robby
"cOdEmOnKeY" <cO********@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
I have created a component that I add to the component tray at Design time.
I need to know how to access a property on this component at Runtime.
From
what I understand I should use Reflection to do this, but I have never
used
Reflection and not sure where to begin.... Could somebody point me in the
right direction?


Nov 21 '05 #3
"cOdEmOnKeY" <cO********@discussions.microsoft.com> schrieb:
I have created a component that I add to the component tray at Design time.
I need to know how to access a property on this component at Runtime.
From
what I understand I should use Reflection to do this


Placing the component on the form will create a private variable holding a
reference to the component's instance. So, if you place a
'System.Windows.Forms.Timer' on your form, which is apparently a component,
and its name is set to 'Timer1', you can access the component using the
variable 'Timer1' inside the form/... you placed the component on.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4

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

Similar topics

7
by: kon george | last post by:
Can somebody assist. I build this code on a dev laptop and copied across the entire code to a Windows 2003 server with 1.1 framework. It is basic ASP.NE T that uses web service for SQL Server...
0
by: Alex VanderWoude | last post by:
I am building a component using C# (but I suppose this question would apply to VB as well). At design time, I want this component to be able to access the development environment. As I understand...
7
by: TJ | last post by:
In C# how do you achieve pass-by-reference property declarations in the Type Library? I am writing a COM Class Library that must mimick an existing library for which the only information is the...
2
by: yaron | last post by:
Hi, I am writing a new networking component (dll). I have a few questions : 1. if i write it with .NET 2 , am i decreasing the number of potentials clients of my component ? 2. if the API to...
4
by: ffhansix | last post by:
Hi, I am trying to reference a COM component (.dll) from Visual Studio 2005 in my windows application in C# by adding a reference to a third party.dll file (tried .type library also), and i get...
122
by: Edward Diener No Spam | last post by:
The definition of a component model I use below is a class which allows properties, methods, and events in a structured way which can be recognized, usually through some form of introspection...
2
by: Martin Arvidsson | last post by:
Hi! I have developed a component that creates a lookup for selecting values. At designtime i want to display the windows as well but with certain criterias. is there a property or something to...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
0
by: bharathreddy | last post by:
In .Net COM+ components are referred to as serviced components, Namespace: System.EnterpriseServices; Advantage of Serviced Components: object pooling, database connection pooling,
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.