Leon Barkan Leon Barkan - 1 year ago 99
C# Question

Refresh list on Events

In my application i have listbox that updated from database.

The changes that can be [Buttons] (OnClick events)

  • Insert new row/rows.

  • Delete row/rows.

  • Edit Row.

  • Refresh the list.

i have a function to do the refresh:

public void DBListBoxRefresh()
dbListBox.DataSource = dbPersonList;

How can i made Event That on every event of that type will refresh the listbox automatically. or other ideas how can i make it instead of invoking the function from every event

Answer Source

You can simply go with += for specific event.

For example:

btnMyButton.Click += CustomEventForMyButton;

private void CustomEventForMyButton(object sender, EventArgs e)
        throw new NotImplementedException();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download