Wiring in events?!??

vis781

Well-known member
Joined
Aug 30, 2005
Messages
2,016
Location
Cambridge, UK
Programming Experience
5-10
Hi all, I have managed to hit what seems to be a major stumbling block on my course to create a user control. It's basically a checkbox that does some other stuff besides. Anyway what the problem is, is that i have noticed that a normal checkbox has two events that mine does not,

CheckedStateChanged
CheckedChanged

I have put these events in but i am struggling with 'wiring them in' someone told me that i wil need to use delegates for such a process. Is this true, if not can anyone help?
 
Last edited:
if we talk about the same yes you have available all features and properties from inherited control .... take a look at the pic below

uuuu.png
 
You may have already made the appropriate choice, but note that you can simply inhertit from the CheckBox class in the first place if you want. A UserControl is generally used as a container for a number of other controls, but if you only have a CheckBox with additional functionality but no additional controls then inheriting CheckBox directly may be more appropriate. As for events, here's the help topic you should start with:

Local: ms-help://MS.MSDNQTR.2003FEB.1033/vbcon/html/vbconRaisingEventsFromYourControl.htm
Online: http://msdn.microsoft.com/library/d...on/html/vbconraisingeventsfromyourcontrol.asp
 
great thanks a lot that really helped. But Ido have one more question. So i have inherited from an existing control and everything now work fine. However this control has a lot of properties that i simply dont need or that i would like to change. I have tries the following that makes them invisible at design time, however Intellisense seems to be able to still see them.

Custom designers: i.e postfiltering the properties
Setting the browsable attribute to false

Any ideas on how i can remove properties from an existing control, and stop intellisense from being able to see them. thanks.
 
I don't think that it's possible. I've read a bit about the NumericUpDown and someone from Microsoft wrote that they'd "hidden" the Text property because it wasn't intended to be used, but that only meant that it wasn't shown in the Properties window. You can still access it in code. You can override a member so it does nothing but I don't think you can remove access to it.
 
I was just thinking in terms of professionality. I just think that it would 'Look' better if the only properties that were there are the ones that are going to be used. Thats the only reason. Thanks very much for the replies.
 
Back
Top