G
Guest
Good Day all,
I'm working on VisualStudio.net and on SQL Server 8.0
I'm using a WindowsForm with a ListBox, some TextBox, some buttons, a DataSet, an sqlDataAdapter and an SqlCommand.
I fill my DataSet normally with this command at the startup of my application
(SqlConnection cnxSqlConnexion
(SqlDataAdaper sdaSalles
(Dataset dsSalles
cnxSqlConnexion.Open();
sdaSalles.Fill(dsSalles, "SALLES");
cnxSqlConnexion.Close();
I've been set my ListBox DataSource and DisplayMember property with the folowing values :
(ListBox lstSalles
lstSalles.DataSource <- dsSalles
lstSalles.DisplayMember <- SALLES.NOMSALLES
When I add a new record all work well :
....
this.BindingContext[dsSalles, "SALLES"].AddNew();
....
....
....
this.BindingContext[dsSalles, "SALLES"].EndCurrentEdit();
....
When I delete a record, I have a problem with the ListBox
....
this.BindingContext[this.dsSalles,"SALLES"].RemoveAt(this.BindingContext[this.dsSalles,"SALLES"].Position);
....
All records in the listBox are deleted excepted the last one who is deleted from the DataBinding but Stay in the lstSalle.List.
Please how to make it leave the lstSalle.List ?
thank's for any solutions !
I'm working on VisualStudio.net and on SQL Server 8.0
I'm using a WindowsForm with a ListBox, some TextBox, some buttons, a DataSet, an sqlDataAdapter and an SqlCommand.
I fill my DataSet normally with this command at the startup of my application
(SqlConnection cnxSqlConnexion
(SqlDataAdaper sdaSalles
(Dataset dsSalles
cnxSqlConnexion.Open();
sdaSalles.Fill(dsSalles, "SALLES");
cnxSqlConnexion.Close();
I've been set my ListBox DataSource and DisplayMember property with the folowing values :
(ListBox lstSalles
lstSalles.DataSource <- dsSalles
lstSalles.DisplayMember <- SALLES.NOMSALLES
When I add a new record all work well :
....
this.BindingContext[dsSalles, "SALLES"].AddNew();
....
....
....
this.BindingContext[dsSalles, "SALLES"].EndCurrentEdit();
....
When I delete a record, I have a problem with the ListBox
....
this.BindingContext[this.dsSalles,"SALLES"].RemoveAt(this.BindingContext[this.dsSalles,"SALLES"].Position);
....
All records in the listBox are deleted excepted the last one who is deleted from the DataBinding but Stay in the lstSalle.List.
Please how to make it leave the lstSalle.List ?
thank's for any solutions !