###前提・実現したいこと
C#のUserControlでButtonClickイベントを作成し、Formでイベントをハンドルしたいのですが、Form内でエラーが出てしまいます。('The name UserControl1.ButtonClick does not exist in the current context')
###UserControl:
public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } public event EventHandler ButtonClick; private void btnUpdate_Click(object sender, EventArgs e) { if (this.ButtonClick != null) this.ButtonClick(this, e); }
###Form:
UserControl1.ButtonClick += new EventHandler(UserControl_ButtonClick); //ここで'The name UserControl1.ButtonClick does not exist in the current context'というエラーメッセージが出てきます。 protected void UserControl_ButtonClick(object sender, EventArgs e) { //handle the event }
###試したこと
UserControl1クラスは念のため何度もBuildしました。
FormとUserControl1クラスは同じプロジェクト内にあります。
他にもUserControl内でテキストボックスをいくつか作っているのですが、それらのプロパティはすべて認識されております。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。