Click here to Skip to main content
15,891,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have tried the datagrid practical examples by Colin Eberhardt. It was programed on Visual Studio 2009. I cannot make it work on Visual Studio 2017 or 2019. Can anyone show me how to set up the Update with a Save Button, like DataGridForms does.
Thanks for your help.
DLR

What I have tried:

C#
public void SeasonsDataProvider()
{
    RecipeDBDataSet dataset = new RecipeDBDataSet();

    adapter = new SeasonsTableAdapter();
    adapter.Fill(dataset.Seasons);

    dataset.Seasons.SeasonsRowChanged +=
        new RecipeDBDataSet.SeasonsRowChangeEventHandler(SeasonsRowModified);
    dataset.Seasons.SeasonsRowDeleted +=
        new RecipeDBDataSet.SeasonsRowChangeEventHandler(SeasonsRowModified);

}
void SeasonsRowModified(object sender, RecipeDBDataSet.SeasonsRowChangeEvent e)
{
                 RecipeDBDataSet dataSet = new RecipeDBDataSet();

    adapter.Update(dataSet.Seasons);
}
Posted
Updated 17-Dec-19 21:10pm
v2
Comments
[no name] 16-Dec-19 17:36pm    
Your datasets are going out of scope because you're not doing anything with them other than (possibly) filling them with data. That is not a "complete" code sample you're showing, so it "never" worked (i.e. it was not a "program").
Richard Deeming 17-Dec-19 14:24pm    
NB: There's no such thing as "Visual Studio 2009". There was a 2008 and a 2010, but no 2009.

1 solution

Please, read this: How to use Commands in WPF[^]. There you'll find an example of how to use "Save" and "Cancel" button.

If you would like to change the behaviour of command depending on state of application (in the wide sense of that statement), check this out: Using WPF commands - The complete WPF tutorial[^]

If you have any question to the author of the original article[^], please use "Add a comment or question" widget under the article.

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900