PC Review


Reply
Thread Tools Rate Thread

C# overrides for controls

 
 
ECVerify.com
Guest
Posts: n/a
 
      9th Feb 2004
I posted this earlier but never got a response...so I am trying again

****************************

Hey everyone,

I have a simple (I hope question)

To get the events in C# I can go to the designer view and I can select
an event for any control or form via the lightning bolt...cool

To get an override for a form I can go to the class view and I can
drill down and get the overrides by right button over the method and
selecting the override and add from the context menu...ok, cool

*****But if I have a button on the form and I want the override of the
button there seems to be no way to get to it. I can see MyButton
listed but to get to the overrides seems impossible.

What I end up having to do is manually adding the override for controls only.

Please help me find how to add them another way.

Thanks, Ed,
 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      10th Feb 2004
Hi,

You can create overrides on the form because you are actually modifying a
class that is derived from Form.
However that is not true for your button as you are modifying an instance of
button.
You might consider deriving a yourbutton from Button and there do the
overrides.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"ECVerify.com" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I posted this earlier but never got a response...so I am trying again
>
> ****************************
>
> Hey everyone,
>
> I have a simple (I hope question)
>
> To get the events in C# I can go to the designer view and I can select
> an event for any control or form via the lightning bolt...cool
>
> To get an override for a form I can go to the class view and I can
> drill down and get the overrides by right button over the method and
> selecting the override and add from the context menu...ok, cool
>
> *****But if I have a button on the form and I want the override of the
> button there seems to be no way to get to it. I can see MyButton
> listed but to get to the overrides seems impossible.
>
> What I end up having to do is manually adding the override for controls

only.
>
> Please help me find how to add them another way.
>
> Thanks, Ed,



 
Reply With Quote
 
ECVerify.com
Guest
Posts: n/a
 
      10th Feb 2004
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:<e#(E-Mail Removed)>...
> Hi,
>
> You can create overrides on the form because you are actually modifying a
> class that is derived from Form.
> However that is not true for your button as you are modifying an instance of
> button.
> You might consider deriving a yourbutton from Button and there do the
> overrides.
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & software development
> miha at rthand com
> www.rthand.com
>
> "ECVerify.com" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I posted this earlier but never got a response...so I am trying again
> >
> > ****************************
> >
> > Hey everyone,
> >
> > I have a simple (I hope question)
> >
> > To get the events in C# I can go to the designer view and I can select
> > an event for any control or form via the lightning bolt...cool
> >
> > To get an override for a form I can go to the class view and I can
> > drill down and get the overrides by right button over the method and
> > selecting the override and add from the context menu...ok, cool
> >
> > *****But if I have a button on the form and I want the override of the
> > button there seems to be no way to get to it. I can see MyButton
> > listed but to get to the overrides seems impossible.
> >
> > What I end up having to do is manually adding the override for controls

> only.
> >
> > Please help me find how to add them another way.
> >
> > Thanks, Ed,


Thanks Miha,

Well it just seemes silly you can get to all the control overrides in
VB.NET and add them with the select of 2 dropdowns but it is difficult
to get add them in C#...thanks for the input, I think I will just
stick to manually creating them rather than deriving every control
that I want to use an override on...it will improve my typing skills


Thanks again Miha for your suggestion.

Ed,
 
Reply With Quote
 
Stephen Martin
Guest
Posts: n/a
 
      10th Feb 2004
Hi Ed,

I think you're confusing overrides and events. When you're working in a form
you would, for example, override the OnLoad method to do your own processing
when the form loads. But, if you had a Button1 you would need to attach an
event handler to handle the Click event since, as Miha said, you cannot
override the OnClick method. Basically, overrides are for descendant classes
and events are for external classes. This is the same in Visual Basic.

What you are talking about is the ability to have the Visual Studio IDE
automatically add the event handler for you. In the C# case, select the
object's properties and click on the lightening bolt button. This will give
you the events for that object, you can then double click on the entry for
any particular event and the IDE will create the handler for you.


"ECVerify.com" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
<snip>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: CSS on controls overrides CSS on themes randy.buchholz Microsoft ASP .NET 0 21st Aug 2008 12:04 PM
Real Player volume control also controls & overrides Media Player Volume ? John2005 Windows XP General 1 10th Aug 2007 03:37 PM
Overrides Controls Method Kalim Julia Microsoft VB .NET 2 27th Jan 2006 02:24 AM
C# to VB Overrides Jim Heavey Microsoft ASP .NET 0 29th Oct 2003 04:35 PM
overrides help please Merlin Microsoft VB .NET 16 1st Sep 2003 09:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:45 AM.