souparno majumder
souparno majumder

Reputation: 2052

Getting error with binding event in c#

I have a button in the design page with name BtnCall;
and I am trying to add the event like this

public MainWindow () : base (Gtk.WindowType.Toplevel)
{
    Build ();
    BtnCall.Click = new System.EventHandler(this.OnBtnCallClicked);
}

but i am getting an error

/home/bonnie/workstation/voip/voip/MainWindow.cs(11,11): Error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer (CS0131) (voip)

Upvotes: 0

Views: 45

Answers (1)

Joel Bourbonnais
Joel Bourbonnais

Reputation: 2718

When you subscribe to an event (Click), you need to use the += syntax.

I invite you to read the EventHandler documentation.

Upvotes: 1

Related Questions