>I am very confused, perhaps because I'm thinking in terms of VFP, and I could use some help please. I'm in c# and .NET.
>
>1. I want to create mytextbox based on class Textbox. Am I making a a usercontrol or a customcontrol to do this? The answer may depend on #2 below.
>
>2. When I drag/drop mytextbox onto my new Window Form, I want to be able to access mytextbox.Text and other properties of the base class - with usercontrol it seems the underlying textbox properties are not accessible in the Properties or in code.
>
>Now I understand that with usercontrol I'm putting the base Textbox into a container, but how do I get into that container in code and in Visual Studio at design time (i.e. setting mytextbox.container.textbox.text?).
>
You can just subclass an existing control. e.g 'class MyTextBox: TextBox'. That way all existing TextBox properties are available in the Properties Window when an instance of MyTextBox is sited on a form at design time. Bit of code needed if you want custom properties to be visible in the Properties window tho.....
If you embed the Textbox in a UserControl you lose access to it's properties unless you specifically add methods to access them...
>Thanks for helping the utterly confused. The c#/.NET documentation is terrible. Perhaps I should switch to Rbase5000! Again, thanks for your help.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement