Message
 
 
To
26/11/2006 03:59:19
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01169162
Message ID:
01172472
Views:
15
Bonnie,

Thank you very much for the sample code. Two more follow up questions, please (you are not getting rid of me easy <g>).
1. Do I understand correctly that you put the code (as in the example you kindly provided) in a .cs file of my project? Like, MyUIClasses.cs?
2. Do I then have to reference this namespace in the forms/classes where I will use them using the "using" syntax. That is, I would put the following in each class?
using MyCompany.WinUI.MyClasses
Again, thank you.

>Dmitry,
>
>>Ok, Bonnie, you asked for it <g>. Watch out, here comes a very newbie question <g>.
>
>LOL! No problem, Dmitry. We were all newbies at one time. <s>
>
>Here's something I've written in the past to answer this type of question. It's for WinForms, but the same applies to WebForms pretty much:
>
>Basically, you'll want a class library that contains your sub-classed UI controls, like textbox, button, etc. Something like this:
>
>using System;
>using System.Drawing;
>using System.Collections;
>using System.ComponentModel;
>using System.Windows.Forms;
>using System.Data;
>
>namespace MyCompany.WinUI.MyClasses
>{
>	public class MyComboBox : System.Windows.Forms.ComboBox
>	{
>		// code here
>	}
>
>	public class MyTextBox : System.Windows.Forms.TextBox
>	{
>		// code here
>	}
>
>	public class MyButton : System.Windows.Forms.Button
>	{
>		// code here
>	}
>}
>
>That's it. These controls can't be sub-classed visually, but as you can see, it's easy enough to do it in code. I have all the basic controls sub-classed in one class library file. Once they're added to the ToolBox, then can be dragged onto any design surface in the IDE.
>
>~~Bonnie
>
>
>
>>Ok, Bonnie, you asked for it <g>. Watch out, here comes a very newbie question <g>. Say, I have a web project, MyProject and I want to create my class library (I am using VFP terminology, so please forgive me) of commonly used controls (e.g dropdownlist, textbox) based on the .NET classes. What do I add to my project, a class? Or maybe you remember a thread or a link that explains how to do it?
>>
>>Thank you.
>>
>>>The cool thing is, Dmitry, is that you can start off with sub-classes with nothing in them and add the features you feel you'll need as you learn more. If you've already sub-classed your basic controls and used those sub-classed controls on your Forms already, then you'll have nothing to change when you start adding additional functionality to your sub-classes.
>>>
>>>~~Bonnie
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View