我正在尝试使用 a 将 a string
from发送form SettingsMenu
到我的 Main 表单Delegate
,结构如下所示:
以 SettingsMenu 形式代表:
delegate void ClocknameReceivedEventHandler(object sender, SettingsMenu.ClocknameReceivedEventArgs e);
SettingsMenu 类中的内部类 ClocknameReceivedEventArgs:
public partial class SettingsMenu : Form
{
internal class ClocknameReceivedEventArgs : EventArgs
{
string _clockname;
public string Clockname
{
get { return _clockname; }
}
public ClocknameReceivedEventArgs(string clockname)
{
_clockname = clockname;
}
}
}
还有更多的代码SettingsMenu
:
public event ClocknameReceivedEventHandler ClocknameReceived;
// Invoke the Changed event; called whenever list changes
protected void OnClocknameReceived(SettingsMenu.ClocknameReceivedEventArgs e)
{
ClocknameReceived(this, e);
}
SettingsMenu
我Main form
使用以下命令捕获来自我的传入数据Event
:
_settings.ClocknameReceived += new ClocknameReceivedEventHandler(ClockClocknameReceived);
我的主窗体上实际从 SettingsMenu 接收字符串的方法:
private void ClockClocknameReceived(object sender, SettingsMenu.ClocknameReceivedEventArgs e)
{
string ClockName;
ClockName = e.Clockname;
lblClockname.Text = ClockName;
}
现在我在 SettingsMenu 类中收到以下错误:
Error 2 Inconsistent accessibility: parameter type 'LivePigeonClient.Forms.SettingsMenu.ClocknameReceivedEventArgs' is less accessible than method 'LivePigeonClient.Forms.SettingsMenu.OnClocknameReceived(LivePigeonClient.Forms.SettingsMenu.ClocknameReceivedEventArgs)' D:\SVN\sentul\Livepigeonflights\trunk\LivePigeonClientSolution\LivePigeonClient\Forms\SettingsMenu.cs 54 24 LivePigeonClient
和
Error 1 Inconsistent accessibility: field type 'LivePigeonClient.Forms.ClocknameReceivedEventHandler' is less accessible than field 'LivePigeonClient.Forms.SettingsMenu.ClocknameReceived' D:\SVN\sentul\Livepigeonflights\trunk\LivePigeonClientSolution\LivePigeonClient\Forms\SettingsMenu.cs 51 52 LivePigeonClient
谁能告诉我我做错了什么?