473,493 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

accessing component from another form

J F
Hi all

I'm totally new to Visual Studio, coming from Delphi.
My question, I'm sure is pretty trivial.

I'm using C#

I have a component class (Project/Add Class/Component Class). In this
component class, I drop an ImageList.

Now, in my main form, I put a button. I would like to define the ImageList
property of my button to be the one created in the component class. I can
achive this by code but I want to define visually (at design time) the
property so I can select the ImageIndex property before compiling.

I hope I was clear, English is not my native tongue ...

TIA

J F
Nov 16 '05 #1
1 2983
Hi,

1. Make the ImageList a public property on the created component. The
simplest way is to open the component in the designer and set the
ImageList's Visibility (or Protection, don't remember the exact name)
property to "public".

2. Now, compile the project and add the component to the main form

3. In the form constructor, add the following line after the call to
InitializeComponent:

myButton.ImageList = myComponent.ImageList // Assumes that the component's
property is
// called ImageList.

I'm afraid there's no fully visual way. You can visually initialize control
properties to another controls or components on the same form (given they
are of the appropriate type), but most likely not to their properties.

BTW: This would be a nice VS .NET feature if such initialization would be
possible!

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"J F" <jf*****@netcourrier.com> wrote in message
news:49**************************@posting.google.c om...
Hi all

I'm totally new to Visual Studio, coming from Delphi.
My question, I'm sure is pretty trivial.

I'm using C#

I have a component class (Project/Add Class/Component Class). In this
component class, I drop an ImageList.

Now, in my main form, I put a button. I would like to define the ImageList
property of my button to be the one created in the component class. I can
achive this by code but I want to define visually (at design time) the
property so I can select the ImageIndex property before compiling.

I hope I was clear, English is not my native tongue ...

TIA

J F


Nov 16 '05 #2

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

Similar topics

26
4019
by: Alan Silver | last post by:
Hello, I have a server running Windows Server 2003, on which two of the web sites use the MegaBBS ASP forum software. Both sites suddenly developed the same error, which seems to be connected to...
6
2712
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is...
2
1653
by: wan2tri | last post by:
hello, good day to all of you, hi, im am new in .net , how can i access two or more object remotely , because currently im only accessing one object, windows services is the host, i have a...
2
1243
by: Bradley Grant | last post by:
I been trying to write a program to access a COM Component for a while now, with out much success so far. The following is part of the code of my program, and this is the message I get, can anyone...
2
1743
by: Edward Diener | last post by:
How does one specify in a component that a property is a pointer to another component ? How is this different from a property that is actually an embedded component ? Finally how is one notified in...
4
1265
by: JackRazz | last post by:
Is there a way to get a components parent form from within the component? Thanks - JackRazz
5
1933
by: RSH | last post by:
I havent been able to set a property from another class with out getting some sort of error. Can someone please tell me what I'm doing wrong here? Public Class Form1
0
12048
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
0
1643
by: aakash | last post by:
Hello Guys I am upsizing ms access project to give it a ms sql connectivity I am having problem in accessing form control values in ms sql function CREATE FUNCTION "ReportList DateRange"() ...
0
7119
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
6989
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
7157
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,...
0
7195
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...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
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...
0
3088
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...
0
1400
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.