473,473 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

C# overrides for controls

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,
Jul 21 '05 #1
3 1888
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" <go****@gencode.com> wrote in message
news:20**************************@posting.google.c om...
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,

Jul 21 '05 #2
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:<e#**************@TK2MSFTNGP10.phx.gbl>...
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" <go****@gencode.com> wrote in message
news:20**************************@posting.google.c om...
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,
Jul 21 '05 #3
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" <go****@gencode.com> wrote in message
news:20**************************@posting.google.c om...
<snip>
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Christopher W. Douglas | last post by:
I am developing a VB.NET app using Visual Studio.NET 2003. VB.NET allows me to create a class with two or more methods that have the same name, as long as they have different (non-optional)...
1
by: | last post by:
Hi, I am loading some crystal reports in a method similar to this (see below). And set the cursor to waiting while the reoprt is loaded, run and shown. BUT while the report is running the cursor...
5
by: ECVerify.com | last post by:
This should be a basic question. In VB.NET in the two drop downs over the source code for a form you can get a list of the events and overrides for that form. In VC++ in the properties window...
9
by: Surrealist | last post by:
I need something likes as when I create an event procedure. I can use top-left and top-right dropdown list of code editor to select object and its exposed events respectively. Then, the IDE,...
2
by: Kalvin | last post by:
I found some code in Google, don't remember where, for an AutoComplete combobox. Everything is great with it except for one thing. If I use the mouse to drop the list down, then start typing to...
3
by: ECVerify.com | last post by:
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...
3
by: A Wieser | last post by:
I created a new Windows Forms Application, with a blank form. The first thing I want to do is override OnPaint, and draw a line across the window. I can't for the life of me figure out how I'm...
2
by: Matt Brown - identify | last post by:
Hello, I'm very new to this level of programming and .net in general. My background is VB. I am attempting to use the WebBrowser control to load a flash movie, and it is a known issue...
12
by: André | last post by:
Hi, i'm learning working with classes. In class "classbase1", i defined an overridable function. In the class "subclass1", i defined the same function with 'Overrides'. In class "classbase2", i...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.