Results 1 to 3 of 3

Thread: Overridable?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382

    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?

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    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:
    1. [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]
    2.         [color=blue]Select Case[/color] m.WParam.ToInt32
    3.             [color=blue]Case[/color] 37 '/// left arrow
    4.                 '// do stuff
    5.             [color=blue]Case[/color] 38 '/// up arrow
    6.                 '// do stuff
    7.             [color=blue]Case[/color] 39 '/// right arrow
    8.                 '/// do stuff
    9.             [color=blue]Case[/color] 40 '/// down arrow
    10.                 '/// do stuff
    11.         [color=blue]End Select[/color]
    12.         [color=blue]Return True[/color]
    13.     [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]

  3. #3
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    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
  •  



Click Here to Expand Forum to Full Width