Click here to Skip to main content
15,887,477 members
Home / Discussions / C#
   

C#

 
AnswerRe: excel??? Pin
David Stone14-Nov-02 6:51
sitebuilderDavid Stone14-Nov-02 6:51 
GeneralRe: excel??? Pin
James T. Johnson14-Nov-02 7:00
James T. Johnson14-Nov-02 7:00 
GeneralRe: excel??? Pin
Stephane Rodriguez.14-Nov-02 7:14
Stephane Rodriguez.14-Nov-02 7:14 
GeneralRe: excel??? Pin
Stephane Rodriguez.14-Nov-02 7:13
Stephane Rodriguez.14-Nov-02 7:13 
AnswerRe: excel??? Pin
mikasa14-Nov-02 7:13
mikasa14-Nov-02 7:13 
AnswerRe: excel??? Pin
Kannan Kalyanaraman14-Nov-02 23:23
Kannan Kalyanaraman14-Nov-02 23:23 
GeneralSubClassing a Parent Form in .NET Pin
mikasa14-Nov-02 6:29
mikasa14-Nov-02 6:29 
GeneralRe: SubClassing a Parent Form in .NET Pin
LongRange.Shooter18-Nov-02 9:13
LongRange.Shooter18-Nov-02 9:13 
It is not really clear here if you are asking about subClassing a control or a form. Each has very different approaches to what you want to do.

So if, for example, you inherited from the textbox control. You inherit all of the base class methods and events. You can (usually) manange your own events by doing:

<br />
private new void Control_Event(parameter, parameter)<br />
{<br />
  mycustom event code<br />
}<br />


I say USUALLY because something like modifying the ADD event for a listbox is not possible since that method lives inside the ListItemCollection which is marked as not-inheritable.

Now....if you are actually managing events from ANOTHER control that is on a form that your custom control will live on, that is a different story.

One approach you can take depends on the use, placement, and mangement of the controls be consistant for all users of this form. You create a base form which contains the custom control, the controls you want to capture events for, and any other pretty-pretties such as header data and such.

Code in all of the events you want coded in there such as closing a combo box when the client clicks on a textbox area (as an example). Test out all of your code making sure that the form behaves the way you want it to. Then when the testing is done, change the project type from Windows Application to Class Library and compile it.

Your developers will create reference to that DLL and when they want to create the form, the do an Add Inherited Form... to create a derived class from your form.

Eek! | :eek: THE ONLY CAVIAT that I have found so far is that inherited forms do not create the [STATHREAD] code. This requires the developer to either a) not have this form start a project -or- b) manually add the [STATHREAD] section to the form before compilation. Eek! | :eek:

An inherited form acts exactly like an inherited class --- you can do your own thing but you won't see the base class methods or code. If a developer attempts to override one of the events you had coded, the compiler will stop it letting him/her know that there is a base method already existing. But they can also polymorph it and put in their own code at will.

Hope this is what you were looking for!

_____________________________________________
The world is a dangerous place.
Not because of those that do evil,
    but because of those who look on and do nothing.

GeneralRe: SubClassing a Parent Form in .NET Pin
mikasa18-Nov-02 9:17
mikasa18-Nov-02 9:17 
QuestionHow to change header of a ListView? Pin
Delegate14-Nov-02 4:39
Delegate14-Nov-02 4:39 
GeneralDataGrid problem Pin
Christian Graus14-Nov-02 0:12
protectorChristian Graus14-Nov-02 0:12 
GeneralRe: DataGrid problem Pin
Paul Watson14-Nov-02 0:23
sitebuilderPaul Watson14-Nov-02 0:23 
GeneralRe: DataGrid problem Pin
James T. Johnson14-Nov-02 3:56
James T. Johnson14-Nov-02 3:56 
GeneralRe: DataGrid problem Pin
Martin Haesemeyer14-Nov-02 6:04
Martin Haesemeyer14-Nov-02 6:04 
QuestionCreation of context menu in a simple button? Pin
EdgarBM13-Nov-02 22:10
EdgarBM13-Nov-02 22:10 
AnswerRe: Creation of context menu in a simple button? Pin
Badgott1819-Nov-02 0:00
Badgott1819-Nov-02 0:00 
GeneralUserControl: Property not showing in Properties tab Pin
Le centriste13-Nov-02 15:52
Le centriste13-Nov-02 15:52 
GeneralRe: UserControl: Property not showing in Properties tab Pin
Delegate14-Nov-02 4:41
Delegate14-Nov-02 4:41 
GeneralNo Syntax Highlighting C# Controls Pin
Bog13-Nov-02 15:17
Bog13-Nov-02 15:17 
GeneralRe: No Syntax Highlighting C# Controls Pin
James T. Johnson13-Nov-02 15:22
James T. Johnson13-Nov-02 15:22 
Questionis there any changes in ? Pin
imran_rafique13-Nov-02 14:26
imran_rafique13-Nov-02 14:26 
AnswerRe: is there any changes in ? Pin
David Stone13-Nov-02 14:39
sitebuilderDavid Stone13-Nov-02 14:39 
Questionhow to convert these strings into int? Pin
imran_rafique13-Nov-02 14:16
imran_rafique13-Nov-02 14:16 
AnswerRe: how to convert these strings into int? Pin
David Stone13-Nov-02 14:35
sitebuilderDavid Stone13-Nov-02 14:35 
AnswerRe: how to convert these strings into int? Pin
Christian Graus13-Nov-02 15:03
protectorChristian Graus13-Nov-02 15:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.