Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Overriding click event in C# forms
Message
De
13/03/2007 00:08:44
 
 
À
08/03/2007 17:40:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
01201869
Message ID:
01202901
Vues:
10
I see. Thanks. It took a while to find links to other forums when editing my account.

>Michael,
>
>I think you should have taken it out of the child form, not the parent form. You wouldn't have to comment it out of designer-generated code (just remove it from the Property Sheet event).
>
>~~Bonnie
>
>
>
>>Bonnie,
>>
>>I had a feeling that the question would be more appropriate for .NET forum , but since Foxpro behaviour was involved decided to send to this category.
>>Yes , thanks, delegate was set up twice and after commenting it in a parent Form Foxpro behaviour was achieved. What I didn't like though is that I had to comment in Designer generated code. Surely more control how inheritance works , but it is not purely visual.
>>
>>Michael
>>
>>>Michael,
>>>
>>>You'd probably be better off posting this kind of question in the .NET forum here instead of in the Fox forum. This particular category (VFP and .NET) is more for questions relating to VFP working with .NET and vice-versa.
>>>
>>>But, that's ok for now ... I'll give you a hand here.
>>>
>>>This *should* work, so I'm guessing that something else is causing the button's click event to fire twice. I think I need to see more of your code (I'm thinking possibly you've set up a delegate to the twButton1_Click event handler in both Form1 and Form2 and you wouldn't need to do that in this case).
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>>The following snippet results in showing "Clicked 2" twice if we inherit from Form2 which can't explain. Without overriding both "Click 1" and "Click 2" are shown.
>>>>
>>>>
>>>>
>>>>   public partial class Form1 : TWForm
>>>>    {
>>>>
>>>>        internal virtual void twButton1_Click(object sender, EventArgs e)
>>>>        {
>>>>            MessageBox.Show("Clicked 1");
>>>>        }
>>>>
>>>>   public partial class Form2 : Form1
>>>>    {
>>>>
>>>>...
>>>>        internal override void twButton1_Click(object sender, EventArgs e)
>>>>        {
>>>>
>>>>            MessageBox.Show("Clicked 2");
>>>>        }
>>>>    }
>>>>
>>>>
>>>>
>>>>Any idea how to achieve Foxpro behaviour to show "Click 2" just once or explain how it works or give a reference to explanation.
>>>>
>>>>
>>>>TIA
>>>>Michael
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform