views:

89

answers:

2

I have a ListBox on a Windows Form that is populated during the Form_Load event like so.

        private void Form1_Load(object sender, EventArgs e)
    {
        SA.Business.ComputerList computerList;
        computerList = SA.Business.Business.GetComputerList();

        this.lbComputers.DataSource = computerList;
        this.lbComputers.DisplayMember = "Name";
    }

The GetComputerList returns a ComputerList Object that inherits from BindingList<>

I have a button on the form that when clicked updates the table that is the source of the data for the ComputerList Object.

After it is done updating I just want to force the ListBox to repoulate itself with the fresh data from the DB.

How can I do this?

A: 

this should work..

// after the code to update the source
Form1_Load(null, null);
Eclipsed4utoo
+1  A: 

Abstract your loading code into a separate function, then call that function from your Form_Load and also from your button click event.

Jon Seigel