troubleshooting Question

Problem saving data

Avatar of JasonWinn
JasonWinn asked on
C#
18 Comments1 Solution275 ViewsLast Modified:
Here is what I am trying to do. (IF ANYONE HAS A BETTER WAY TO DO THIS PLEASE LET ME KNOW).

I have job entries, by row in sql, that are put there via dataset in C# program.

My goal is to have people check off things that are required for those job entries, like "estimated, po received, contract received" ect.

I was not sure if it was possible to work with checkboxes in sql so this was my plan:

When the user clicks on the DataGridView, the textboxes that are databound display the related data. (This works fine).

The user then has several checkboxes on the form. These checkboxes are databound to a textboxes on the form. These textboxes are storing/showing information from quickbooks:

estimateCheckbox - - - > estimateTextField.

The idea is that, when a user checks a checkbox, it changes the textbox and saves that information to sql. So when a user loads a job entry, the checkbox looks at the textbox, and based on the data in the textbox, the Checkbox is either True or False.

Simple right?

Here is the problem, when the user clicks a checkbox, the data in the textbox correctly changes to Y or N. The problem is, the data does not save.

However, if the user clicks the checkbox, the datachanges, then they click on a cell in the datagridview, it saves. Because I also have a save script for "onCellClick" in the datagridview.

Why does it not save when the user clicks save, but it saves when the user clicks Save and then a Cell?

Thanks, Here is the code for the OnCell event and the Save Button (SAVE button is what the user clicks after they make there selection on the checkbox).

        private void jobIntakeDataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
           
            if (estimate.Text == "Y")
                estimateBox.Checked = true;
            else
                estimateBox.Checked = false;
            this.Validate();
            this.jobIntakeBindingSource.EndEdit();
            this.jobIntakeTableAdapter.Update(this.rescueScheduleDataSet.jobIntake);


        }

   

        private void saveButton_Click(object sender, EventArgs e)
        {
            if (estimateBox.Checked == true)
                estimate.Text = "Y";
            else
                estimate.Text = "N";

            this.Validate();
            this.jobIntakeBindingSource.EndEdit();
            this.jobIntakeTableAdapter.Update(this.rescueScheduleDataSet.jobIntake);

        }
ASKER CERTIFIED SOLUTION
Gautham Janardhan

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros