I'm trying to attach a ADO EF object class (Materials) to a ListBox, and have it auto-update when a new material is added to the database.
In my current code below, it will show any items that are in the database before the controls datasource is set, but it will not update.
I know I'm missing something elementary here. Any help is greatly appreciated!
public partial class Main : KryptonForm
{
private AGAEntities db = new AGAEntities();
public Main()
{
InitializeComponent();
}
private void Main_Load(object sender, EventArgs e)
{
matList.DataSource = db.Materials;
matList.DisplayMember = "Name";
}
private void newMat_Click(object sender, EventArgs e)
{
AddMaterial form = new AddMaterial();
form.ShowDialog();
}
}