|
Re: Where is my User Control: msg#00371windows.devel.dotnet.winforms
Griffiths, Ian wrote: > > > Many's the time I've just dropped some other control type onto > > the form and then done a search and replace to replace it with > > my control type. > Fabian Schmied replied: > Wow, that's a great idea, so simple yet so effective. Before anyone else tries this and breaks their forms, I feel I should point out two things: (1) Make sure that the placeholder control you put down and plan to replace is the only control of its type on the form. (Otherwise you'll replace all the other ones too!) (2) Be aware that by using this trick, you're editing the contents of InitializeComponent here, which can sometimes confuse the Forms Designer. It owns that method, and if you put code in there that it doesn't understand (i.e. code that doesn't look like something the Forms Designer would have generated) typically deletes that code next time you change the form. (To be fair, there are great big warnings in the source code telling you not to edit this function...) So it's a good idea to take backups, or check stuff into source control before making this kind of change, because it might be more destructive than you intended... (But it's still a useful trick.) -- Ian Griffiths - DevelopMentor http://www.interact-sw.co.uk/iangblog/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: User v Custom Controls: 00371, Griffiths, Ian |
|---|---|
| Next by Date: | Re: User v Custom Controls: 00371, Fabian Schmied |
| Previous by Thread: | Re: User v Custom Controlsi: 00371, Andy Schott |
| Next by Thread: | Re: Where is my User Control: 00371, Fabian Schmied |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |