Passing Values to Event Handler of Dynamic Buttons
<p>I'm trying to pass two values on Button_Click Event</p>

<pre><code>public MyClass()
{
    Int64 po = 123456;
    foreach (Expense expense in pr.Expenses)
    {
        Button btnExpenseDetail = new Button();
        btnExpenseDetail.Text = expense.ExpenseName;
        btnExpenseDetail.Location = new Point(startLocation.X + 410, startLocation.Y + (23 * 
        btnExpenseDetail.Click += (sender, e) =&gt; { MyHandler(sender, e, po , expense.ExpenseName); };            
        pnlProjectSummary_Expenses.Controls.Add(btnExpenseDetail);
    }
}  


void MyHandler(object sender, EventArgs e, string po, string category)
{
    FormExpenseDetails ed = new FormExpenseDetails(po, category);
    ed.Show();
}
</code></pre>

<p>I'm using visual studio 2010 c#. On the panel each Button's text values are all different. But the the buttons' Click_Events are acting all the same. Could someone tell me which part of code i am getting this logical error?</p>

<p>========================================================================</p>
