Hello community,
[Note : I've simplified my example for clarity]
Let's say that I have a Sqlite database with two tables: Items and Sectors:
Items:
id_items : INTEGER PRIMARY KEY
name_item : VARCHAR(...)
id_sector : INTEGER
Sectors:
id_sector : INTEGER PRIMARY KEY
name_sector : VARCHAR(...)
I currently have a datagridview that is bound to the Items table. It gets fed alright, and the table displays the sector as a datagridviewcomboboxcolumns.
Hence, in my Winforms CustomControl, I have all the data loading and binding that occurs in the load() method:
colSector.DataSource = m_dataContext.SectorTable;
colSector.DisplayMember = "name_sector";
colSector.ValueMember = "id_sector";
ItemsGrid.DataSource = new DataView(m_dataContext.ItemsTable);
The comboboxes of my dataview are well loaded with the data from the Sectors table.
I now would like a button on my form that would allow the creation of a new sector:
I created a txtbox (txtNewSector) and a button that triggers the creation:
private void btnAddNewSector_Click(object sender, EventArgs e)
{
// Add new sector to db
m_dataContext.AddNewSector(newSectorName);
// refresh dataview so that comboboxes are updated with the new entry
???
}
How can I perform that refresh?
I hope the edit made the question more clear, please advise....
best regards