Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

accessing component from another form
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

Report this thread to moderator Post Follow-up to this message
Old Post
J F
04-27-04 07:22 AM


Re: accessing component from another form
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" <jfk_pub@netcourrier.com> wrote in message
news:49fcea0a.0404261908.514d3b48@posting.google.com...
> 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


Report this thread to moderator Post Follow-up to this message
Old Post
Dmitriy Lapshin [C# / .NET MVP]
04-27-04 05:16 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

C# .NET archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:28 AM.

 

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.