views:

120

answers:

1

I'm working on a project that is requiring me to add multiple user controls to a panel. What I would like to do with these custom controls is highlight the currently selected control and low-light the others. My problem is that my custom controls aren't receiving the GotFocus/LostFocus messages. Am I missing something here?

This is how I'm loading my control into the panel.

int count = 0;
foreach(DataRow dr in ds.Tables[0].Rows)
{
    PricingModel.GUI.Controls.PriceView pv = new PricingModel.GUI.Controls.PriceView(_session, dr["product"].ToString().Trim());
    pv.Visible = true;
    pv.Top = pv.Height * count;

    _priceViewPanel.Controls.Add(pv);
    count++;
}

I'm using .Net(1.1) any help would be greatly appreciated.

+1  A: 

You need to add code to actually handle those events, like this:

pv.GotFocus += new EventHandler(pv_GotFocus);
pv.LostFocus += new EventHandler(pv_LostFocus);
MusiGenesis