|
-
Aug 4th, 2003, 07:55 PM
#1
Thread Starter
Hyperactive Member
Overridable?
Protected Overridable Sub Whatever()
...
End Sub
Can anyone tell me what exactely the "Overridable" keyword is used for? What does it do and why would someone use it?
-
Aug 4th, 2003, 08:42 PM
#2
a good example of how an override sub works is this... looking at the form's KeyPreview and catching the keyboard buttons that you cant see getting pressed on keydown ( left , right , up , down ), override gives you more control over whats happening and allows you to prevent things happening ( True / False )
VB Code:
[color=blue]Protected[/color] [color=blue]Overrides Function[/color] ProcessKeyPreview([color=blue]ByRef[/color] m [color=blue]As[/color] System.Windows.Forms.Message) [color=blue]As Boolean[/color]
[color=blue]Select Case[/color] m.WParam.ToInt32
[color=blue]Case[/color] 37 '/// left arrow
'// do stuff
[color=blue]Case[/color] 38 '/// up arrow
'// do stuff
[color=blue]Case[/color] 39 '/// right arrow
'/// do stuff
[color=blue]Case[/color] 40 '/// down arrow
'/// do stuff
[color=blue]End Select[/color]
[color=blue]Return True[/color]
[color=blue]End Function[/color]
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Aug 5th, 2003, 05:06 AM
#3
Addicted Member
When you create a class which inherits from the class with the overridable method/function, you can override this method/function using 'overrides', the inherited class can have its own implementation of that method/function.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|