473,769 Members | 5,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't get a simple Extender Provider to work

I have created a simple Extender Provider and when I drop it onto a
form, it appears in the component tray, but none of the controls it is
supposed to provide a property for show the property in the
PropertyGrid!

Here is the class. The GlassButton is a custom button control that
derives from button and I just do some custom painting. I am sure I
have just omitted something simple, but I cannot see it.

I am using VS 2005.

//This code from BeepProvider.cs

using System;
using System.Componen tModel;
using System.Componen tModel.Design;
using System.Drawing. Design;
using System.Collecti ons.Generic;
using System.Diagnost ics;
using System.Text;
using System.Windows. Forms;

[ProvideProperty ("BeepWhenClick ed", typeof(GlassBut ton))]
public partial class BeepProvider : Component, IExtenderProvid er
{

Dictionary<Glas sButton, bool> _beeps;

public BeepProvider()
{
InitializeCompo nent();
_beeps = new Dictionary<Glas sButton, bool>();
}

public BeepProvider(IC ontainer container)
: this()
{
container.Add(t his);
}

bool IExtenderProvid er.CanExtend(ob ject extendee)
{
if ((extendee is GlassButton) && !(extendee is BeepProvider))
return true;
else
return false;
}

public bool GetBeepWhenClic ked(GlassButton gb)
{
return _beeps[gb];
} //end method GetBeedWhenClic ked

public void SetBeepWhenClic ked(GlassButton gb, bool value)
{
_beeps[gb] = value;
if (value)
gb.Click += new EventHandler(On Click);
else
gb.Click -= new EventHandler(On Click);
}

private void OnClick(object sender, EventArgs e)
{
System.Console. Beep(1000, 50);
}
}

//This code from BeepProvider.De signer.cs

using System.Componen tModel;
using System.Windows. Forms;

[ProvideProperty ("BeepProvider" , typeof(GlassBut ton))]
partial class BeepProvider
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.IContain er components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing ">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Disp ose();
}
base.Dispose(di sposing);
}

#region Component Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
components = new System.Componen tModel.Containe r();
}

#endregion
}

Apr 26 '06 #1
1 1770
Chris Dunaway wrote:
Here is the class. The GlassButton is a custom button control that
derives from button and I just do some custom painting. I am sure I
have just omitted something simple, but I cannot see it.
It wasn't very simple or intuitive, but here is my solution:
[ProvideProperty ("BeepWhenClick ed", typeof(GlassBut ton))]
public partial class BeepProvider : Component, IExtenderProvid er
In these lines I can't use my custom control class name, it has to be
Control like this:

[ProvideProperty ("BeepWhenClick ed", typeof(Control) )]
public partial class BeepProvider : Component, IExtenderProvid er

{

Dictionary<Glas sButton, bool> _beeps;

Next, I can not use a generic dictionary but I have to use a Hashtable
like this:

Hashtable _beeps;

public BeepProvider()
{
InitializeCompo nent();
_beeps = new Dictionary<Glas sButton, bool>();
use a Hashtable here as well.

_beeps = new Hashtable();
bool IExtenderProvid er.CanExtend(ob ject extendee)
{
if ((extendee is GlassButton) && !(extendee is BeepProvider))
return true;
else
return false;
}
This part is Ok, I can use GlassButton here to restrict what controls
are extended

public bool GetBeepWhenClic ked(GlassButton gb)
public void SetBeepWhenClic ked(GlassButton gb, bool value)


These two methods had to be changed to Control rather than GlassButton
What I don't understand is why. Does anyone have any insight?

Thanks,

Chris

Apr 26 '06 #2

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

Similar topics

0
1739
by: wayne mcfadden | last post by:
Hi, I'm stumped. Our text extenders stopped working on one database. I think that i'm missing something simple here. The column is enabled... but when you do an index status it doesn't know anything about it. Any thoughts? Thanks
4
2417
by: Jeff | last post by:
I am trying to run the getstart_prep.cmd to enable the SALES_DB on the "/var/tmp/db2/ese/db2/solaris/db2xml81/reloc/IBM/db2/\$PRODVERS/bin/dxxadm enable_db SALES_DB" command I get the following error: SQL0444N Routine "*EnableDB" (specific name "SQL040218113955930") is implemented with code in library or path ".../sqllib/function/db2xml", function "dxxEnableDB" which cannot be accessed. Reason code: "4". SQLSTATE=42724 DXXM001W A...
1
1338
by: Nina via DBMonster.com | last post by:
Hi, I am trying to use the AIV extender with DB2 PE v 8.2. However, when i try to enable database for DB2Video I get the following error report: db2ext => enable database for db2video DMB0030E: The current database cannot be enabled for the "db2video" extender. RC = -1. DMB0036E: The DB2 Extender Server cannot be started or stopped. The DB2
0
1211
by: JezB | last post by:
Could anyone tell me how to implement an extender provider for ASP.NET ? I have done this successfully for windows forms but all the online documentation tells us is : The implementation of an extender provider for Windows Forms controls is different from that for ASP.NET server controls.
2
1392
by: JezB | last post by:
Could anyone tell me how to implement an extender provider for ASP.NET ? I have done this successfully for windows forms but all the online documentation tells us is : The implementation of an extender provider for Windows Forms controls is different from that for ASP.NET server controls.
7
1069
by: Tim | last post by:
hi all, a simple OO related question... I have some controls. Say, a textbox, a combo and a datepicker. They all share some properties (tag, size etc). How should I add another shared property to them all? Eg a property called "RequiredField" so I can go textbox.requiredfield=true, combo.requiredfield=false etc etc
9
2667
by: Andrew | last post by:
Hi, I implemented a simple WMI Provider in C#. It is a service which expose 10 instances of a simple WMI Class. The WMI class pnly expose 4 public properties (Value,Min,Max,StdValue) which only return some constant data. First, I was using MOM 2005 (Windows 2003) to interogate the instances values.
11
3315
by: Brad | last post by:
To DB2 Personal Developer Edition GIS users: How do I acquire a spatial extender license key for the DB2 PDE? I expected to be able to use it right out of the box. Brad
1
6077
by: bellgodz | last post by:
Hello, I have a text box on an .aspx page that an AJAX calendar extender is tied to. When this page is loaded the text box in question is populated with a date from a selected record. I've tried using the "SelectedValue" property of the calendar extender to populate this text box, but what happens is this text box retains the focus after the page is loaded, which causes the calendar from the calendar extender to appear. I do not want this...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10039
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9860
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6668
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5297
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3955
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.