Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this messageHi, 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
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.