|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Refer to childs of user control.Hello.
In VB.NET 2008 : I created a user control. The user control has label (one of its components). I want : When using the final user control by the IDE, I shall be able to pick up the label control alone, make events on it, or change the label text. How can I do that ? Thanks :) Am 15.04.2010 00:25, schrieb Mr. X.:
> Hello. In the Usercontrol designer, select the label. Change the 'Modifier' to 'Public'.> In VB.NET 2008 : > I created a user control. > The user control has label (one of its components). > I want : > When using the final user control by the IDE, I shall be able to pick up the > label control alone, > make events on it, or change the label text. > > How can I do that ? After compiling, open the Form and select teh Usercontrol. The label appears in the list of properties. Expand it to change it's properties. You have to use the AddHandler statement to handle the label's events. -- Armin I need to see the label's event directly via the IDE.
(I want to be able to make a user control - built it, put it on the my form, and see some of the inner elements of the controls, and be able to see their events and properties on the IDE). How can I do that ? Any other way ? (like populate all the properties and events of the inner control, to the main user control - but if there are 100 properties, I.e ?) Thanks :) Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:u2hc#UC3KHA.5196@TK2MSFTNGP05.phx.gbl... > Am 15.04.2010 00:25, schrieb Mr. X.: >> Hello. >> In VB.NET 2008 : >> I created a user control. >> The user control has label (one of its components). >> I want : >> When using the final user control by the IDE, I shall be able to pick up >> the >> label control alone, >> make events on it, or change the label text. >> >> How can I do that ? > > In the Usercontrol designer, select the label. Change the 'Modifier' to > 'Public'. > After compiling, open the Form and select teh Usercontrol. The label > appears > in the list of properties. Expand it to change it's properties. You have > to use the AddHandler statement to handle the label's events. > > -- > Armin Am 15.04.2010 06:30, schrieb Mr. X.:
> I need to see the label's event directly via the IDE. "IDE" is a big term. The designer or the code editor?If you use the Addhandler statement as I've suggested, intellisense works as always and will list the events. > (I want to be able to make a user control - built it, put it on the my form, The designer just simplifies creating code. What you want is not a feature.> and see some of the inner elements of the controls, and be able to see their > events and properties on the IDE). > How can I do that ? > Any other way ? (like populate all the properties and events of the inner > control, to the main user control - but if there are 100 properties, I.e ?) You have to type "Addhandler MyUsercontrol1.MyLabel." and have intellisense list the events. (BTW, I'v never used the events view in the properties window) -- Armin Sorry for my bad English.
I meant on design time, and not on runtime. If there is no other choice I shall use Addhandler. Thanks :) Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:OihkTYJ3KHA.1624@TK2MSFTNGP06.phx.gbl... > Am 15.04.2010 06:30, schrieb Mr. X.: >> I need to see the label's event directly via the IDE. > > "IDE" is a big term. The designer or the code editor? > If you use the Addhandler statement as I've suggested, > intellisense works as always and will list the events. > >> (I want to be able to make a user control - built it, put it on the my >> form, >> and see some of the inner elements of the controls, and be able to see >> their >> events and properties on the IDE). >> How can I do that ? >> Any other way ? (like populate all the properties and events of the inner >> control, to the main user control - but if there are 100 properties, I.e >> ?) > > The designer just simplifies creating code. What you want is not a > feature. > You have to type "Addhandler MyUsercontrol1.MyLabel." and have > intellisense > list the events. (BTW, I'v never used the events view in the properties > window) > > -- > Armin Another thing.
Look at menuStrip control. When putting it on form on design time, there are inner item elements, that can be shown too (with events ...) That's kind of behavior, that I want to. Thanks :) Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:OihkTYJ3KHA.1624@TK2MSFTNGP06.phx.gbl... > Am 15.04.2010 06:30, schrieb Mr. X.: >> I need to see the label's event directly via the IDE. > > "IDE" is a big term. The designer or the code editor? > If you use the Addhandler statement as I've suggested, > intellisense works as always and will list the events. > >> (I want to be able to make a user control - built it, put it on the my >> form, >> and see some of the inner elements of the controls, and be able to see >> their >> events and properties on the IDE). >> How can I do that ? >> Any other way ? (like populate all the properties and events of the inner >> control, to the main user control - but if there are 100 properties, I.e >> ?) > > The designer just simplifies creating code. What you want is not a > feature. > You have to type "Addhandler MyUsercontrol1.MyLabel." and have > intellisense > list the events. (BTW, I'v never used the events view in the properties > window) > > -- > Armin Am 15.04.2010 21:13, schrieb Mr. X.:
> That's kind of behavior, that I want to. Yes, but it's not what you get.-- Armin Sorry, but I missed something.
There are some user-control, as just for example : MenuStrip, that has MenuStripItem, which I can click on MenuStripItem, and change its properties and events. I thought that's I can build my own user control, and at the same way change the inner controls at design time. Can I do that (at the same way MenuStrip could do that) ? Thanks :) Am 16.04.2010 10:37, schrieb Mr. X.:
> Sorry, but I missed something. MenuStrip is, as an aside, no usercontrol.> > There are some user-control, as just for example : MenuStrip, > that has which is a Component but not a control. That means, the difference> MenuStripItem, which I can click on MenuStripItem, between a menustrip and a usercontrol is that the menustripitems are not contained in the Controls collection of the MenuStrip. > and change its properties yep, properties> and events. Never noticed that, because, as I said, I never use the events in the propertieswindow, and the only event of interest with a MenuStripItem is the click event, and that one is created when I double-click on it. But that's just me. You are absolutely right. Well, it's the MenuStrip designer that works that way. The Usercontrol designer doesn't. > I thought that's I can build my own user control, and at the same way change As I've already carefully tried to express: No, you can't do that. :-)> the inner controls at design time. > Can I do that (at the same way MenuStrip could do that) ? I guess the reason is that a Usercontrol should encapsulate all it's functunality in most cases, and there's not sufficient request for the remaining cases. Ddon't know. Maybe someone knows how to extend the IDE with such a feature. Look if it's already been requested. If not, you can do it: https://connect.microsoft.com/VisualStudio/feedback/ -- Armin O.K.
I created a class object, with properties. Add the class to toolbar. I didn't check the whole functionality (I created also a b = button, and did b.parent = parent, but didn't see it on form). It seems I can control the behavior, and not persist using userControl. Problem was solved partially. Anyway, thanks :) Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:#epOxcV3KHA.4332@TK2MSFTNGP02.phx.gbl... > Am 16.04.2010 10:37, schrieb Mr. X.: >> Sorry, but I missed something. >> >> There are some user-control, as just for example : MenuStrip, > > MenuStrip is, as an aside, no usercontrol. > >> that has >> MenuStripItem, which I can click on MenuStripItem, > > which is a Component but not a control. That means, the difference > between a menustrip and a usercontrol is that the menustripitems > are not contained in the Controls collection of the MenuStrip. > >> and change its properties > > yep, properties > >> and events. > > Never noticed that, because, as I said, I never use the events in the > properties > window, and the only event of interest with a MenuStripItem is the click > event, > and that one is created when I double-click on it. > > But that's just me. You are absolutely right. Well, it's the MenuStrip > designer > that works that way. The Usercontrol designer doesn't. > >> I thought that's I can build my own user control, and at the same way >> change >> the inner controls at design time. >> Can I do that (at the same way MenuStrip could do that) ? > > As I've already carefully tried to express: No, you can't do that. :-) > I guess the reason is that a Usercontrol should encapsulate all it's > functunality in most cases, and there's not sufficient request for > the remaining cases. Ddon't know. > > Maybe someone knows how to extend the IDE with such a feature. > > Look if it's already been requested. If not, you can do it: > https://connect.microsoft.com/VisualStudio/feedback/ > > -- > Armin |
|||||||||||||||||||||||