Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Visual Inheritance wOOPs
Message
From
10/11/2006 07:32:15
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
 
To
10/11/2006 04:09:50
General information
Forum:
ASP.NET
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01168684
Message ID:
01168695
Views:
10
This message has been marked as the solution to the initial question of the thread.
Hi Richard I have more experience in VB.NET, can read C# code but for explaining I will use vb.net since for c# I would have to be looking into help and would take allot more time to reply ;)
In .net you have Function, Procedures(usually call methods) and Events that will then have an eventhandler to deal with that event, i.e. the Form Load where in Vb.NET gets declared in something like
Private Sub Form1_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles MyBase.Load
    'have some code here...
End Sub
Now if you declare another form that will inherit from Form1 and put some code in the form load what will happen is that both with fire since what you have is 2 procedures that handles the same event, and you can't control that.
Now what you can do is define methods (functions, procedures) like the following
method example of the base form
Public Sub Overridable DoSomeWork()
   messagebox.Show("First part of Local Method (Base Class).")
End Sub
Now on your inherit form you can create then the following
Public Sub Overrides DoSomeWork()
   'only if I want to process the code that's on my base class, 
   'If I suppress the MyBase call then no Base class code get's fired.
   MyBase.DoSomeWork()
   messagebox.Show("Second part of Local Method (Inherit Class).")
End Sub
I'm sure you can understand the idea and convert this to C#.
Hope this clarify everything, Don't think how used to work in VFP, cause if you go that root will be allot harder to learn .NET instead think this is what I need to do now how will that be possible in .net or java, or any other language you decide to work with, if you follow this, you will see that will be allot easy to learn a new language.


>wOOPs
>
>Seems like I asked the wrong question
>
>I have been trying since i got into PocketPC to develop a Framework for my programmes
>
>Looked at an old Blogg from a year ago and found what i wanted 7 months ago!!!!
>
>Ive got a class library containing a Form C#
>
>I have inherited from that Form and got methods working in the inheritaed form from both the Base Class and the form ((Arnt I clever!!!)
>
>this is using the Protected Virtual bits of VS
>
>How do I call the method in the Base Form WHEN I WANT - you can do this in FOX
>
>
>ie
>FORM METHOD
>messagebox.Show("First part of Local Method")
>\\ call the method in the base class (Or I supose other mehod in base class)messagebox.Show("Code in Base Method")
>
>messagebox.Show("Second part of Local Method")
>
>If you can tell me how to do it in VSudio C# I can test it in PocketPC
>
>Regards
>
>Richard
Alexandre Palma
Senior Application Architect
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform