|
|
 |
 |
 |
 |
How to create a user control container?
Don't get me wrong - I'm a fan of .NET; I am enthusiastic about the richness and elegance of the environment. However, richness and elegance should be dedicated toward making development easier for developers, not more difficult. In many ways this goal is achieved. However, I've run up against one particular area of development, where what should be a trivial excercise is turning out to be much more difficult than it should be. I'm trying to devleop a user control which will act as the container for other controls. Why do I think this should be easy? Well, it used to be very easy. In VB6 all we'd need to do is set the UserControl's ControlContainer property to True. Done. In .NET it doesn't seem that it should be any more difficult. The following creates a user control onto which I can drop other controls when I'm working with this control in another project. [Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public partial class SRSPanel : UserControl { OK, that works as far as it goes, however, at run time I'm experiencing a problem which is an absolute show-stopper to my implementation. When focus is on the last control contained within my control, and the Tab key is pressed, focus does not move to the next control in the tab order on the current form. Rather, a beep is issued and the cursor remains where it is. 1. Why does this happen? 2. How do I handle this? Has anyone created a control container in .NET? Have you seen this problem? How do you handle this? Thanks very much for your help! - Joseph Geretz -
Joseph, You are going to have to provide a complete code sample which shows what you are experiencing. What you have given isn't nearly enough information to go on. -- - Nicholas Paldino [.NET/C# MVP] - m@spam.guard.caspershouse.com "Joseph Geretz" <jger @nospam.com> wrote in message news:ebQyUqEqHHA.2652@TK2MSFTNGP02.phx.gbl...
> Don't get me wrong - I'm a fan of .NET; I am enthusiastic about the > richness and elegance of the environment. However, richness and elegance > should be dedicated toward making development easier for developers, not > more difficult. In many ways this goal is achieved. However, I've run up > against one particular area of development, where what should be a trivial > excercise is turning out to be much more difficult than it should be. I'm > trying to devleop a user control which will act as the container for other > controls. > Why do I think this should be easy? Well, it used to be very easy. In VB6 > all we'd need to do is set the UserControl's ControlContainer property to > True. Done. > In .NET it doesn't seem that it should be any more difficult. The > following creates a user control onto which I can drop other controls when > I'm working with this control in another project. > [Designer("System.Windows.Forms.Design.ParentControlDesigner, > System.Design, Version=2.0.0.0, Culture=neutral, > PublicKeyToken=b03f5f7f11d50a3a")] > public partial class SRSPanel : UserControl > { > OK, that works as far as it goes, however, at run time I'm experiencing a > problem which is an absolute show-stopper to my implementation. When focus > is on the last control contained within my control, and the Tab key is > pressed, focus does not move to the next control in the tab order on the > current form. Rather, a beep is issued and the cursor remains where it is. > 1. Why does this happen? > 2. How do I handle this? > Has anyone created a control container in .NET? Have you seen this > problem? How do you handle this? > Thanks very much for your help! > - Joseph Geretz -
Thanks Nicholas for putting me on the right track. Although I've built other user controls, this one is the first container I'm building. When I came across this behavior, I thought that this is endemic to the container aspect of the control. You asked me to put together a code sample and I thought, OK easy enough. I put together a simple container control and lo and behold - it works perfectly. Right now, I'm in the process of tearing down the complexity of my container control. When I find out what has been causing the problem I will post back to the group. (In the meantime, may I remove foot from mouth? ;-) Thanks! - Joseph Geretz - "Nicholas Paldino [.NET/C# MVP]" <m@spam.guard.caspershouse.com> wrote in message news:evITpzEqHHA.4032@TK2MSFTNGP02.phx.gbl...
> Joseph, > You are going to have to provide a complete code sample which shows > what you are experiencing. What you have given isn't nearly enough > information to go on. > -- > - Nicholas Paldino [.NET/C# MVP] > - m@spam.guard.caspershouse.com > "Joseph Geretz" <jger@nospam.com> wrote in message > news:ebQyUqEqHHA.2652@TK2MSFTNGP02.phx.gbl... >> Don't get me wrong - I'm a fan of .NET; I am enthusiastic about the >> richness and elegance of the environment. However, richness and elegance >> should be dedicated toward making development easier for developers, not >> more difficult. In many ways this goal is achieved. However, I've run up >> against one particular area of development, where what should be a >> trivial excercise is turning out to be much more difficult than it should >> be. I'm trying to devleop a user control which will act as the container >> for other controls. >> Why do I think this should be easy? Well, it used to be very easy. In VB6 >> all we'd need to do is set the UserControl's ControlContainer property to >> True. Done. >> In .NET it doesn't seem that it should be any more difficult. The >> following creates a user control onto which I can drop other controls >> when I'm working with this control in another project. >> [Designer("System.Windows.Forms.Design.ParentControlDesigner, >> System.Design, Version=2.0.0.0, Culture=neutral, >> PublicKeyToken=b03f5f7f11d50a3a")] >> public partial class SRSPanel : UserControl >> { >> OK, that works as far as it goes, however, at run time I'm experiencing a >> problem which is an absolute show-stopper to my implementation. When >> focus is on the last control contained within my control, and the Tab key >> is pressed, focus does not move to the next control in the tab order on >> the current form. Rather, a beep is issued and the cursor remains where >> it is. >> 1. Why does this happen? >> 2. How do I handle this? >> Has anyone created a control container in .NET? Have you seen this >> problem? How do you handle this? >> Thanks very much for your help! >> - Joseph Geretz -
Strange. I tore out all functionality and re-added the code step by step. Tabbing works just fine. I have no idea what the problem was. Thanks for pointing me in the right direction. Joseph Geretz "Joseph Geretz" <jger @nospam.com> wrote in message news:%23LrhvMFqHHA.3660@TK2MSFTNGP04.phx.gbl...
> Thanks Nicholas for putting me on the right track. > Although I've built other user controls, this one is the first container > I'm building. When I came across this behavior, I thought that this is > endemic to the container aspect of the control. You asked me to put > together a code sample and I thought, OK easy enough. I put together a > simple container control and lo and behold - it works perfectly. > Right now, I'm in the process of tearing down the complexity of my > container control. When I find out what has been causing the problem I > will post back to the group. > (In the meantime, may I remove foot from mouth? ;-) > Thanks! > - Joseph Geretz - > "Nicholas Paldino [.NET/C# MVP]" <m@spam.guard.caspershouse.com> wrote > in message news:evITpzEqHHA.4032@TK2MSFTNGP02.phx.gbl... >> Joseph, >> You are going to have to provide a complete code sample which shows >> what you are experiencing. What you have given isn't nearly enough >> information to go on. >> -- >> - Nicholas Paldino [.NET/C# MVP] >> - m@spam.guard.caspershouse.com >> "Joseph Geretz" <jger@nospam.com> wrote in message >> news:ebQyUqEqHHA.2652@TK2MSFTNGP02.phx.gbl... >>> Don't get me wrong - I'm a fan of .NET; I am enthusiastic about the >>> richness and elegance of the environment. However, richness and elegance >>> should be dedicated toward making development easier for developers, not >>> more difficult. In many ways this goal is achieved. However, I've run up >>> against one particular area of development, where what should be a >>> trivial excercise is turning out to be much more difficult than it >>> should be. I'm trying to devleop a user control which will act as the >>> container for other controls. >>> Why do I think this should be easy? Well, it used to be very easy. In >>> VB6 all we'd need to do is set the UserControl's ControlContainer >>> property to True. Done. >>> In .NET it doesn't seem that it should be any more difficult. The >>> following creates a user control onto which I can drop other controls >>> when I'm working with this control in another project. >>> [Designer("System.Windows.Forms.Design.ParentControlDesigner, >>> System.Design, Version=2.0.0.0, Culture=neutral, >>> PublicKeyToken=b03f5f7f11d50a3a")] >>> public partial class SRSPanel : UserControl >>> { >>> OK, that works as far as it goes, however, at run time I'm experiencing >>> a problem which is an absolute show-stopper to my implementation. When >>> focus is on the last control contained within my control, and the Tab >>> key is pressed, focus does not move to the next control in the tab order >>> on the current form. Rather, a beep is issued and the cursor remains >>> where it is. >>> 1. Why does this happen? >>> 2. How do I handle this? >>> Has anyone created a control container in .NET? Have you seen this >>> problem? How do you handle this? >>> Thanks very much for your help! >>> - Joseph Geretz -
Ha! You did all the work, I didn't do anything. I'm glad you fixed the problem though. -- - Nicholas Paldino [.NET/C# MVP] - m@spam.guard.caspershouse.com "Joseph Geretz" <jger @nospam.com> wrote in message news:Ox3JL0GqHHA.4532@TK2MSFTNGP06.phx.gbl...
> Strange. I tore out all functionality and re-added the code step by step. > Tabbing works just fine. I have no idea what the problem was. > Thanks for pointing me in the right direction. > Joseph Geretz > "Joseph Geretz" <jger@nospam.com> wrote in message > news:%23LrhvMFqHHA.3660@TK2MSFTNGP04.phx.gbl... >> Thanks Nicholas for putting me on the right track. >> Although I've built other user controls, this one is the first container >> I'm building. When I came across this behavior, I thought that this is >> endemic to the container aspect of the control. You asked me to put >> together a code sample and I thought, OK easy enough. I put together a >> simple container control and lo and behold - it works perfectly. >> Right now, I'm in the process of tearing down the complexity of my >> container control. When I find out what has been causing the problem I >> will post back to the group. >> (In the meantime, may I remove foot from mouth? ;-) >> Thanks! >> - Joseph Geretz - >> "Nicholas Paldino [.NET/C# MVP]" <m@spam.guard.caspershouse.com> wrote >> in message news:evITpzEqHHA.4032@TK2MSFTNGP02.phx.gbl... >>> Joseph, >>> You are going to have to provide a complete code sample which shows >>> what you are experiencing. What you have given isn't nearly enough >>> information to go on. >>> -- >>> - Nicholas Paldino [.NET/C# MVP] >>> - m@spam.guard.caspershouse.com >>> "Joseph Geretz" <jger@nospam.com> wrote in message >>> news:ebQyUqEqHHA.2652@TK2MSFTNGP02.phx.gbl... >>>> Don't get me wrong - I'm a fan of .NET; I am enthusiastic about the >>>> richness and elegance of the environment. However, richness and >>>> elegance should be dedicated toward making development easier for >>>> developers, not more difficult. In many ways this goal is achieved. >>>> However, I've run up against one particular area of development, where >>>> what should be a trivial excercise is turning out to be much more >>>> difficult than it should be. I'm trying to devleop a user control which >>>> will act as the container for other controls. >>>> Why do I think this should be easy? Well, it used to be very easy. In >>>> VB6 all we'd need to do is set the UserControl's ControlContainer >>>> property to True. Done. >>>> In .NET it doesn't seem that it should be any more difficult. The >>>> following creates a user control onto which I can drop other controls >>>> when I'm working with this control in another project. >>>> [Designer("System.Windows.Forms.Design.ParentControlDesigner, >>>> System.Design, Version=2.0.0.0, Culture=neutral, >>>> PublicKeyToken=b03f5f7f11d50a3a")] >>>> public partial class SRSPanel : UserControl >>>> { >>>> OK, that works as far as it goes, however, at run time I'm experiencing >>>> a problem which is an absolute show-stopper to my implementation. When >>>> focus is on the last control contained within my control, and the Tab >>>> key is pressed, focus does not move to the next control in the tab >>>> order on the current form. Rather, a beep is issued and the cursor >>>> remains where it is. >>>> 1. Why does this happen? >>>> 2. How do I handle this? >>>> Has anyone created a control container in .NET? Have you seen this >>>> problem? How do you handle this? >>>> Thanks very much for your help! >>>> - Joseph Geretz -
|
 |
 |
 |
 |
|