Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Override a method in a custom control.

Override a method in a custom control.

Scheduled Pinned Locked Moved C#
questioncsharp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kakarato
    wrote on last edited by
    #1

    I've write a button base class. In the click even't i put code below: this.Enabled = false; this.Clicked(); //is a public virtual method in the class. this.Enabled = true; So next time when i when i use the button control i just need to put all my code in the Clicked() method in the custom button control. But the proplem is how do i put the in the Clicked() method ? In VFP i just need to override the Clicked() method with mu on code. But in C# it seen like quit confusing for me. Please advice. Thanks. Below is the complete class code. public class stdTextBox:System.Windows.Forms.Button { protected override void OnClick(EventArgs e) { this.Enabled = false; this.clicked(); this.Enabled = true; } private void clicked() { } }

    C 1 Reply Last reply
    0
    • K kakarato

      I've write a button base class. In the click even't i put code below: this.Enabled = false; this.Clicked(); //is a public virtual method in the class. this.Enabled = true; So next time when i when i use the button control i just need to put all my code in the Clicked() method in the custom button control. But the proplem is how do i put the in the Clicked() method ? In VFP i just need to override the Clicked() method with mu on code. But in C# it seen like quit confusing for me. Please advice. Thanks. Below is the complete class code. public class stdTextBox:System.Windows.Forms.Button { protected override void OnClick(EventArgs e) { this.Enabled = false; this.clicked(); this.Enabled = true; } private void clicked() { } }

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      What is VFP ? Clicked is not a method, it's an event. You need to add an OnClicked handler, either by overriding the method, or writing a handler and adding it to the Click method. Here[^] is some info on the topic. Christian Graus - Microsoft MVP - C++

      K 1 Reply Last reply
      0
      • C Christian Graus

        What is VFP ? Clicked is not a method, it's an event. You need to add an OnClicked handler, either by overriding the method, or writing a handler and adding it to the Click method. Here[^] is some info on the topic. Christian Graus - Microsoft MVP - C++

        K Offline
        K Offline
        kakarato
        wrote on last edited by
        #3

        VFP = Visual FoxPro. Thanks you very much.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups