473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

ComponentChangedEventHandler

This is my code :

using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Reflection;
namespace Nox.Componente
{
/// <summary>
/// Summary description for WizardControl.
/// </summary>
public class WizardControl: Component
{
// Variáveis locais
private WizardPages _Pages;
private TabControl _TabControl;

// Propriedades
[Description("Páginas que formam o assistente.")]
[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)]
public WizardPages Pages
{
get {return _Pages;}
set {_Pages = value;}
}

[Description("Tabcontrol do assistente.")]
public TabControl TabControl
{
get {return _TabControl;}
set {_TabControl = value;}
}

public WizardControl()
{
_Pages = new WizardPages(this);
}

// Metodos de design-time
private IComponentChangeService ChangeService;
public override ISite Site
{
get
{
return base.Site;
}
set
{
if (value == null)
{
ClearChangeNotifications();
return;
}

base.Site = value;

// Clear any component change event handlers.
ClearChangeNotifications();
RegisterChangeNotifications();
}
}

private void ClearChangeNotifications()
{
// O valor ChangeService é nulo quando não estiver em design mode,
// assim como IComponentChangeService só está disponÃ*vel em design time.
ChangeService =
(IComponentChangeService)GetService(typeof(ICompon entChangeService));

if (ChangeService != null)
{
ChangeService.ComponentRemoving -= new
ComponentChangedEventHandler(OnComponentRemoving);
}
}

private void RegisterChangeNotifications()
{
ChangeService =
(IComponentChangeService)GetService(typeof(ICompon entChangeService));

if (ChangeService != null)
{
ChangeService.ComponentRemoving += new
ComponentChangedEventHandler(OnComponentRemoving);
}
}

private void OnComponentRemoving(object sender, ComponentEventArgs ce)
{
}

}

}
When I compile, this message is show :

Method 'Nox.Componente.WizardControl.OnComponentRemoving( object,
System.ComponentModel.Design.ComponentEventArgs)' does not match delegate
'void System.ComponentModel.Design.ComponentChangedEvent Handler(object,
System.ComponentModel.Design.ComponentChangedEvent Args)'
What is wrong ?
Nov 16 '05 #1
1 1279
The signature of the OnComponentRemoving() method doesn't match the
signature of the delegate. You have to use ComponentChangedEventArgs instead
of ComponentEventArgs.

-- Ricky Lee
==================================================
^o^ "When all doors are closed, God will open a Windows" ^o^
==================================================
"Rogerio Jun" <Ro********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
This is my code :

using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Reflection;
namespace Nox.Componente
{
/// <summary>
/// Summary description for WizardControl.
/// </summary>
public class WizardControl: Component
{
// Variáveis locais
private WizardPages _Pages;
private TabControl _TabControl;

// Propriedades
[Description("Páginas que formam o assistente.")]
[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)]
public WizardPages Pages
{
get {return _Pages;}
set {_Pages = value;}
}

[Description("Tabcontrol do assistente.")]
public TabControl TabControl
{
get {return _TabControl;}
set {_TabControl = value;}
}

public WizardControl()
{
_Pages = new WizardPages(this);
}

// Metodos de design-time
private IComponentChangeService ChangeService;
public override ISite Site
{
get
{
return base.Site;
}
set
{
if (value == null)
{
ClearChangeNotifications();
return;
}

base.Site = value;

// Clear any component change event handlers.
ClearChangeNotifications();
RegisterChangeNotifications();
}
}

private void ClearChangeNotifications()
{
// O valor ChangeService é nulo quando não estiver em design mode,
// assim como IComponentChangeService só está disponível em design time.
ChangeService =
(IComponentChangeService)GetService(typeof(ICompon entChangeService));

if (ChangeService != null)
{
ChangeService.ComponentRemoving -= new
ComponentChangedEventHandler(OnComponentRemoving);
}
}

private void RegisterChangeNotifications()
{
ChangeService =
(IComponentChangeService)GetService(typeof(ICompon entChangeService));

if (ChangeService != null)
{
ChangeService.ComponentRemoving += new
ComponentChangedEventHandler(OnComponentRemoving);
}
}

private void OnComponentRemoving(object sender, ComponentEventArgs ce)
{
}

}

}
When I compile, this message is show :

Method 'Nox.Componente.WizardControl.OnComponentRemoving( object,
System.ComponentModel.Design.ComponentEventArgs)' does not match delegate
'void System.ComponentModel.Design.ComponentChangedEvent Handler(object,
System.ComponentModel.Design.ComponentChangedEvent Args)'
What is wrong ?

Nov 16 '05 #2

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

Similar topics

4
by: CroDude | last post by:
I've made a custom groupbox control. Inside, as one of it's members is CSimpleGradient object. CSimpleGradient is a wrapper class for gradient usage. Basically it looks like that: public class...
4
by: Matt Fielder | last post by:
I have a control that the user is able to manually resize --- and it works great. The problem is I need to handle something when the control is done being resized, but not during the resize, so...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.