none
Record add to accdb works in Visual studio, but it does not work from the exe. How do I successfully add from the .exe? RRS feed

  • Question

  • I have developed a database app which successfully performs the following:

    1) accepts partial strings into any WPF field, then performs a search, filling a list box with key values of records matching the search criteria

    2) allows point-and-click access to fill a new window(identical to the search window) with the values from the selected record

    3) saves updates to record data

    4) allows the allocation of new records by filling in values in another identical window, including a "Save new record" button.

    All of the above works perfectly when the program is executed within Visual Studio 2015.

    However, when the same processes are attempted using the .exe, everything works except the <Add new record>.  The app crashes.

    How can I fix this?  The database resides in C:\Program Data.

    Wednesday, September 27, 2017 10:33 PM

All replies

  • Hi irSharp,

    According to your question is more related to database, I will move the thread to ADO.NET Managed Providers Forum  for suitable support.

    And you should offer some specify information for us , For example, what do you mean " the same processes are attempted using the .exe", and also you should provide <Add new record> function  relating code so that we can do further test with it.

    Sincerely,
    neil hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 28, 2017 2:30 AM
  • You're saying that it will update a row with changes input from your application, but it crashes when you try to save a new row that's just been added, right? Is any kind of error reported when it crashes? Have you checked the event log?

    Do you have a try/catch around your DataAccess code? You should, because:

    1) It won't crash, because you'll catch the exception.
    2) You can log the exception somewhere (like to event log, or a TextBox on your form or even just writing a file) so that you can see what the exception is.

    What does your connection string look like and are you sure you're using the exact same connection string for both of your database operations?


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Thursday, September 28, 2017 5:02 AM
  • Hi,

    >> Record add to accdb works in Visual studio, but it does not work from the exe. 

    What do you mean? what is it does not work from the exe but work in Visual Studio.

    >> However, when the same processes are attempted using the .exe, everything works except the <Add new record>.  The app crashes.

    Can you share your application for us? Please show your code for the ... ,I have no idea how you're..., so it's hard to make any kind of suggestions.

    I think you've not really explained enough to be specific, maybe you can rephrase your question and give us more context.

    Best Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 28, 2017 6:27 AM
  • I'll try to shed more light on my problem.

    When I click "Build Solution" on the "Build" drop-down menu at the top of the Visual Studio 2015 window, the app successfully compiles with no errors or alerts.
    As with all Visual Studio apps, I can click the <Start> button at the top of the window, but a successful build also creates an exe file which is stored in the app's "bin==>Debug" subfolder in Windows Explorer.

    When I click the <Start> button within Visual Studio 2015, the app runs perfectly, including the option to add a new record.  In the routine to add a new record, the app:

    (1)allocates a new record,

    (2)assigns an auto-generated pseudo-key value(a value recognizable by the user--not the GUID) via a routine I developed,

    (3)allows the user to specify record detail values by entering in TextBoxes, DatePickers, RadioButton groups, and Checkbox groups.

    However, when I go to the "bin==>Debug" subfolder of the app within Windows Explorer, I run the distributable exe file, and all other features of the app run perfectly(Search/Edit), but the <Add New Record> does not.

    Why would the app run perfectly within Visual Studio 2015, yet create an exe version that does not fully work?


    • Edited by irsharp Thursday, September 28, 2017 12:15 PM
    Thursday, September 28, 2017 12:14 PM
  • What do you mean by "app crashes"? Do you get an exception (error) message?

    What type of database are you working with?


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, September 28, 2017 1:42 PM
  • All windows in the app abruptly close, with not even a system message showing up.

    As for the type of database, the title of my original post included accdb.  Is that what you are referring to?

    • Edited by irsharp Thursday, September 28, 2017 5:24 PM
    Thursday, September 28, 2017 5:22 PM
  • Have you used a try/catch anywhere, as I suggested earlier?

    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Thursday, September 28, 2017 5:54 PM
  • There are already several "try-catch" pairs in the code.

    Below is the massive record save routine:

           

    privatevoidbtnSaveCurrentAF_Form_1067_Click(objectsender, RoutedEventArgse)

            {

               

    boolaf1067Success,

    non_af1067Success;

               

    this.Cursor = Cursors.Wait;

                ta_tracking_AF1067_fields =

    newwpfNewAFForm1067.New_AF1067_TrackingDataSetTableAdapters.tracking_AF1067_fieldsTableAdapter();

                ta_tracking_AF1067_fields.Fill(aF1067_TrackingDataSet.tracking_AF1067_fields);

                ta_tracking_non_AF1067_fields =

    newwpfNewAFForm1067.New_AF1067_TrackingDataSetTableAdapters.tracking_non_AF1067_fieldsTableAdapter();

                ta_tracking_non_AF1067_fields.Fill(aF1067_TrackingDataSet.tracking_non_AF1067_fields);

               

    //MessageBox.Show("checking to see if record already exists...", "AF Form 1067");


               

    intqryCount = Convert.ToInt32(ta_tracking_AF1067_fields.CountQuery(tbLeadCommandControlNo.Text));

               

    //MessageBox.Show(Convert.ToString(qryCount), "# found");


               

    if(qryCount == 0)

                {

                   

    //* * * * * * * * * * * * * * * * * * * * * * N E W   R E C O R D * * * * * * * * * * * * * * * * * * * * * *


                   

    //Record does not exist


                   

    //Allocate new row in tracking_AF1067_fields


                   

    New_AF1067_TrackingDataSet.tracking_AF1067_fieldsRownew_tracking_AF1067_fieldsRow;

                    new_tracking_AF1067_fieldsRow = aF1067_TrackingDataSet.tracking_AF1067_fields.Newtracking_AF1067_fieldsRow();

                   

    //Set primary key from GUID for tracking_AF1067_fields


                    new_tracking_AF1067_fieldsRow.PK_AF1067 =

    Guid.NewGuid().ToString();

                    pK_AF1067 = new_tracking_AF1067_fieldsRow.PK_AF1067;

                    fK_AF1067 = pK_AF1067;

                   

    //Copy data values from window to current tracking_AF1067_ fields record


                    new_tracking_AF1067_fieldsRow.LeadCommandControlNo = tbLeadCommandControlNo.Text;

                   

    if(proposalDateDatePicker.SelectedDate != null)

                        new_tracking_AF1067_fieldsRow.ProposalDate = proposalDateDatePicker.SelectedDate.Value;

                   

    else


                        new_tracking_AF1067_fieldsRow.ProposalDate = nullDate;

                    new_tracking_AF1067_fieldsRow.Initiator = initiatorTextBox.Text;

                    new_tracking_AF1067_fieldsRow.Org = orgTextBox.Text;

                    new_tracking_AF1067_fieldsRow.POC_ValidatedBy = pOC_ValidatedByTextBox.Text;

                    new_tracking_AF1067_fieldsRow.ModTitle = tbModTitle.Text;

                    new_tracking_AF1067_fieldsRow.OrgControlNo = tbOrgControlNo.Text;

                    new_tracking_AF1067_fieldsRow.OtherNumbers = tbOtherNumbers.Text;

                    new_tracking_AF1067_fieldsRow.MDS = tbMDS.Text;

                    new_tracking_AF1067_fieldsRow.WUC = tbWUC.Text;

                    new_tracking_AF1067_fieldsRow.NSN = tbNSN.Text;

                    new_tracking_AF1067_fieldsRow.SRD = tbSRD.Text;

                    new_tracking_AF1067_fieldsRow.OTHER = tbOTHER.Text;

                    new_tracking_AF1067_fieldsRow.NOUN = tbNOUN.Text;

                    new_tracking_AF1067_fieldsRow.Comments = commentsTextBox.Text;

                    new_tracking_AF1067_fieldsRow.Purpose = tbPurpose.Text;

                    new_tracking_AF1067_fieldsRow.Impact = tbImpact.Text;

                    new_tracking_AF1067_fieldsRow.Constraints = tbConstraints.Text;

                    new_tracking_AF1067_fieldsRow.Part1_Validation = aF1067_TrackingDataSet.tracking_AF1067_fields[0].Part1_Validation;

                   

    if(dateRecvdInAFFSADatePicker.SelectedDate != null)

                        new_tracking_AF1067_fieldsRow.DateRecvdInAFFSA = dateRecvdInAFFSADatePicker.SelectedDate.Value;

                   

    else


                        new_tracking_AF1067_fieldsRow.DateRecvdInAFFSA = nullDate;

                   

    try


                    {

                       

    if(!Convert.IsDBNull(new_tracking_AF1067_fieldsRow.Part1_Validation))

                        {

                           

    if(chkOrgVal_A.IsChecked == true|| rdoOrgVal_A.IsChecked == true|| new_tracking_AF1067_fieldsRow.Part1_Validation == "A")

                            {

                                new_tracking_AF1067_fieldsRow.Part1_Validation =

    "A";

                                chkOrgVal_A.IsChecked =

    true;

                                rdoOrgVal_A.IsChecked =

    true;

                               

    //MessageBox.Show("OrgVal A is checked!");


                            }

                           

    else


                           

    if(chkOrgVal_B.IsChecked == true|| rdoOrgVal_B.IsChecked == true|| new_tracking_AF1067_fieldsRow.Part1_Validation == "B")

                            {

                                new_tracking_AF1067_fieldsRow.Part1_Validation =

    "B";

                                chkOrgVal_B.IsChecked =

    true;

                                rdoOrgVal_B.IsChecked =

    true;

                               

    //MessageBox.Show("OrgVal B is checked!");


                            }

                           

    else


                           

    if(chkOrgVal_C.IsChecked == true|| rdoOrgVal_C.IsChecked == true|| new_tracking_AF1067_fieldsRow.Part1_Validation == "C")

                            {

                                new_tracking_AF1067_fieldsRow.Part1_Validation =

    "C";

                                chkOrgVal_C.IsChecked =

    true;

                                rdoOrgVal_C.IsChecked =

    true;

                               

    //MessageBox.Show("OrgVal C is checked!");


                            }

                           

    else


                            {

                               

    //new_tracking_AF1067_fieldsRow.Part1_Validation = "";


                               

    MessageBox.Show("No boxes are checked for Part I Validation!");

                            }

                        }

                    }

                   

    catch


                    {

                        new_tracking_AF1067_fieldsRow.Part1_Validation =

    "";

                       

    MessageBox.Show("Error saving Part1_Validation from OrgVal in new record!");

                    }

           

    }

     


    • Edited by irsharp Thursday, September 28, 2017 7:39 PM
    Thursday, September 28, 2017 7:03 PM
  • //***************************************************************************************************************************

                    new_tracking_AF1067_fieldsRow.Part1_Name = part12_NameTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part1_Grade = part12_GradeTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part1_Title = part12_TitleTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part1_DSN = part12_DSNTextBox.Text;
                    if (part12_DateDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.Part1_Date = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.Part1_Date = part12_DateDatePicker.SelectedDate.Value;
                    //MessageBox.Show("Part I field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                    try
                    {
                        if (rdoUsingCmdVal_A.IsChecked == true || chkUsingCmdVal_A.IsChecked == true || new_tracking_AF1067_fieldsRow.UsingCommandVal == "A")
                        {
                            rdoUsingCmdVal_A.IsChecked = true;
                            chkUsingCmdVal_A.IsChecked = true;
                            new_tracking_AF1067_fieldsRow.UsingCommandVal = "A";
                        }
                        else
                        if (rdoUsingCmdVal_B.IsChecked == true || chkUsingCmdVal_B.IsChecked == true || new_tracking_AF1067_fieldsRow.UsingCommandVal == "B")
                        {
                            rdoUsingCmdVal_B.IsChecked = true;
                            chkUsingCmdVal_B.IsChecked = true;
                            new_tracking_AF1067_fieldsRow.UsingCommandVal = "B";
                        }
                        else
                        if (rdoUsingCmdVal_C.IsChecked == true || chkUsingCmdVal_C.IsChecked == true || new_tracking_AF1067_fieldsRow.UsingCommandVal == "C")
                        {
                            rdoUsingCmdVal_C.IsChecked = true;
                            chkUsingCmdVal_C.IsChecked = true;
                            new_tracking_AF1067_fieldsRow.UsingCommandVal = "C";
                        }
                        else
                        if (rdoUsingCmdVal_D.IsChecked == true || chkUsingCmdVal_D.IsChecked == true || new_tracking_AF1067_fieldsRow.UsingCommandVal == "D")
                        {
                            rdoUsingCmdVal_D.IsChecked = true;
                            chkUsingCmdVal_D.IsChecked = true;
                            new_tracking_AF1067_fieldsRow.UsingCommandVal = "D";
                        }
                        else
                            new_tracking_AF1067_fieldsRow.UsingCommandVal = "";
                    }
                    catch
                    {
                        new_tracking_AF1067_fieldsRow.UsingCommandVal = "";
                    }

                    new_tracking_AF1067_fieldsRow.Part2_Name = part2_NameTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part2_Grade = part2_GradeTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part2_Title = part2_TitleTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part2_DSN = part2_DSNTextBox.Text;
                    if (part2_DateDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.Part2_Date = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.Part2_Date = part2_DateDatePicker.SelectedDate.Value;
                    if (pt2DateRecvdDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.Pt2DateRecvd = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.Pt2DateRecvd = pt2DateRecvdDatePicker.SelectedDate.Value;
                    new_tracking_AF1067_fieldsRow.Part2_Validation = new_tracking_AF1067_fieldsRow.UsingCommandVal;
                    new_tracking_AF1067_fieldsRow.UsingCommandControlNo = tbUsingCommandControlNo.Text;
                    //MessageBox.Show("Part II field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                    if (rdoLeadCommandVal_A.IsChecked == true)
                        new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "A";
                    else
                    if (rdoLeadCommandVal_B.IsChecked == true)
                        new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "B";
                    else
                        new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "";
                    new_tracking_AF1067_fieldsRow.Part3_Name = part3_NameTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part3_Grade = part3_GradeTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part3_Title = part3_TitleTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part3_DSN = part3_DSNTextBox.Text;
                    if (part3_DateDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.Part3_Date = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.Part3_Date = part3_DateDatePicker.SelectedDate.Value;
                    if (pt3DateRecvdDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.Pt3DateRecvd = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.Pt3DateRecvd = pt3DateRecvdDatePicker.SelectedDate.Value;
                    new_tracking_AF1067_fieldsRow.LeadCommand_AO = leadCommand_AO_TextBox.Text;
                    new_tracking_AF1067_fieldsRow.OptionalRouting = optionalRoutingTextBox.Text;
                    new_tracking_AF1067_fieldsRow.SingleManagerOffice = singleManagerOfficeTextBox.Text;
    Thursday, September 28, 2017 7:41 PM
  •                 try
                    {
                        if (rdoT_1.IsChecked == true || chkT_1.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "1")
                        {
                            new_tracking_AF1067_fieldsRow.ModType = "1";
                            rdoT_1.IsChecked = true;
                            rdoT_2.IsChecked = false;
                            rdoP.IsChecked = false;
                            rdoS.IsChecked = false;
                            chkT_1.IsChecked = true;
                            chkT_2.IsChecked = false;
                            chkPermanent.IsChecked = false;
                            chkSafety.IsChecked = false;
                        }
                        else
                        if (rdoT_2.IsChecked == true || chkT_2.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "2")
                        {
                            new_tracking_AF1067_fieldsRow.ModType = "2";
                            rdoT_1.IsChecked = false;
                            rdoT_2.IsChecked = true;
                            rdoP.IsChecked = false;
                            rdoS.IsChecked = false;
                            chkT_1.IsChecked = false;
                            chkT_2.IsChecked = true;
                            chkPermanent.IsChecked = false;
                            chkSafety.IsChecked = false;
                        }
                        else
                        if (rdoP.IsChecked == true || chkPermanent.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "P")
                        {
                            new_tracking_AF1067_fieldsRow.ModType = "P";
                            rdoT_1.IsChecked = false;
                            rdoT_2.IsChecked = false;
                            rdoP.IsChecked = true;
                            rdoS.IsChecked = false;
                            chkT_1.IsChecked = false;
                            chkT_2.IsChecked = false;
                            chkPermanent.IsChecked = true;
                            chkSafety.IsChecked = false;
                        }
                        else
                        if (rdoS.IsChecked == true || chkSafety.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "S")
                        {
                            new_tracking_AF1067_fieldsRow.ModType = "S";
                            rdoT_1.IsChecked = false;
                            rdoT_2.IsChecked = false;
                            rdoP.IsChecked = false;
                            rdoS.IsChecked = true;
                            chkT_1.IsChecked = false;
                            chkT_2.IsChecked = false;
                            chkPermanent.IsChecked = false;
                            chkSafety.IsChecked = true;
                        }
                        else
                            new_tracking_AF1067_fieldsRow.ModType = "";
                    }
                    catch
                    {
                        new_tracking_AF1067_fieldsRow.ModType = "";
                    }
                    new_tracking_AF1067_fieldsRow.Lead_Command_Remarks = leadCommandRemarksTextBox.Text;
                    if (rdoLeadCommandVal_A.IsChecked == true)
                        new_tracking_AF1067_fieldsRow.Lead_Command_Val = true;
                    else
                        new_tracking_AF1067_fieldsRow.Lead_Command_Val = false;
                    //MessageBox.Show("Part III field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                    if (pt4DateRecvdDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.Pt4DateRecvd = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.Pt4DateRecvd = pt4DateRecvdDatePicker.SelectedDate.Value;
                    new_tracking_AF1067_fieldsRow.Part4_Name = part4_NameTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part4_Grade = part4_GradeTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part4_Title = part4_TitleTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part4_DSN = part4_DSNTextBox.Text;
                    if (part4_DateDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.Part4_Date = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.Part4_Date = part4_DateDatePicker.SelectedDate.Value;
                    if (rdoTemporary.IsChecked == true)
                        new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "T";
                    else
                    if (rdoDisapprove.IsChecked == true)
                        new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "D";
                    else
                    if (rdoPermanent.IsChecked == true)
                        new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "P";
                    else
                    if (rdoMNS_ORD.IsChecked == true)
                        new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "M";
                    else
                        new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "";
                    new_tracking_AF1067_fieldsRow.Part4_Comments = part4_CommentsTextBo.Text;
                    new_tracking_AF1067_fieldsRow.Single_Manager_AO = single_Manager_AOTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Center_MIP_No = tbCenter_MIP_No.Text;
                    new_tracking_AF1067_fieldsRow.ECP_No = tbECP_No.Text;
                    new_tracking_AF1067_fieldsRow.TCTO_No = tbTCTO_No.Text;
                    new_tracking_AF1067_fieldsRow.Total_BP_EEIC = 0;
                    int n;
                    bool isNumeric = int.TryParse(tbTotal_BP_EEIC.Text, out n);
                    new_tracking_AF1067_fieldsRow.Total_BP_EEIC = n;
                    new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = 0;
                    isNumeric = int.TryParse(nR_of_CIS_AffectedTextBox.Text, out n);
                    new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                    new_tracking_AF1067_fieldsRow.Total_Kits_Needed = 0;
                    isNumeric = int.TryParse(total_Kits_NeededTextBox.Text, out n);
                    new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                    new_tracking_AF1067_fieldsRow.WorkHours_User = 0;
                    isNumeric = int.TryParse(workHours_UserTextBox.Text, out n);
                    new_tracking_AF1067_fieldsRow.WorkHours_User = n;
                    new_tracking_AF1067_fieldsRow.WorkHours_Depot = 0;
                    isNumeric = int.TryParse(workHours_DepotTextBox.Text, out n);
                    new_tracking_AF1067_fieldsRow.WorkHours_Depot = n;
    Thursday, September 28, 2017 7:42 PM
  •                 try
                    {
                        Int32 workHours_Total = Convert.ToInt32(aF1067_TrackingDataSet.tracking_AF1067_fields[0].WorkHours_User) + Convert.ToInt32(aF1067_TrackingDataSet.tracking_AF1067_fields[0].WorkHours_Depot);
                        //MessageBox.Show(Convert.ToString(workHours_Total));
                        workHours_TotalTextBox.Text = Convert.ToString(workHours_Total);
                        tbWorkHours_Total.Text = Convert.ToString(workHours_Total);
                    }
                    catch
                    {
                        MessageBox.Show("WorkHours addition didn't work!");
                    }
                    new_tracking_AF1067_fieldsRow.SupportEquipAff = Convert.ToBoolean(supportEquipAffCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.AircrewTrainingAff = Convert.ToBoolean(aircrewTrainingAffCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.TrainingDev_AidsAff = Convert.ToBoolean(trainingDev_AidsAffCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.TechDataAff = Convert.ToBoolean(techDataAffCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.SparesAff = Convert.ToBoolean(sparesAffCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.SoftwareAff = Convert.ToBoolean(softwareAffCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.OtherAff = Convert.ToBoolean(otherAffCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.OtherAff_Spec = otherAff_SpecTextBox.Text;
                    decimal nDec;
                    isNumeric = decimal.TryParse(kit_UnitCostTextBox.Text, out nDec);
                    new_tracking_AF1067_fieldsRow.Kit_UnitCost = nDec;
                    isNumeric = decimal.TryParse(totalCostTextBox.Text, out nDec);
                    new_tracking_AF1067_fieldsRow.TotalCost = nDec;
                    new_tracking_AF1067_fieldsRow.LeadTime = leadTimeTextBox.Text;
                    if (installBeginDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.InstallBegin = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.InstallBegin = installBeginDatePicker.SelectedDate.Value;
                    if (installComplDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.InstallCompl = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.InstallCompl = installComplDatePicker.SelectedDate.Value;
                    new_tracking_AF1067_fieldsRow.LevelOfAccomp_User = Convert.ToBoolean(levelOfAccomp_UserCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.LevelOfAccomp_Depot = Convert.ToBoolean(levelOfAccomp_DepotCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.LevelOfAccomp_Both = Convert.ToBoolean(levelOfAccomp_BothCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.LevelOfAccomp_Other = Convert.ToBoolean(levelOfAccomp_OtherCheckBox.IsChecked);
                    new_tracking_AF1067_fieldsRow.Manufacturer = manufacturerTextBox.Text;
                    new_tracking_AF1067_fieldsRow.AC_Breakout = aC_BreakoutTextBox.Text;
                    new_tracking_AF1067_fieldsRow.EngRev_Recommendations = engRev_RecommendationsTextBox.Text;
                    if (rdoSSM_Approved.IsChecked == true)
                        new_tracking_AF1067_fieldsRow.SSM_Approved = true;
                    else
                        new_tracking_AF1067_fieldsRow.SSM_Approved = false;
                    if (dateSentToSSMDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = dateSentToSSMDatePicker.SelectedDate.Value;
                    new_tracking_AF1067_fieldsRow.Part5_Name = part5_NameTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part5_Grade = part5_GradeTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part5_Title = part5_TitleTextBox.Text;
                    new_tracking_AF1067_fieldsRow.Part5_DSN = part5_DSNTextBox.Text;
                    if (part5_DateDatePicker.SelectedDate == null)
                        new_tracking_AF1067_fieldsRow.Part5_Date = nullDate;
                    else
                        new_tracking_AF1067_fieldsRow.Part5_Date = part5_DateDatePicker.SelectedDate.Value;
                    // Add the row to the tracking_AF1067_fields table
                    this.aF1067_TrackingDataSet.tracking_AF1067_fields.Rows.Add(new_tracking_AF1067_fieldsRow);
                    MessageBox.Show("AF1067 Row added!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                    // Save the new row to the database
                    this.ta_tracking_AF1067_fields.Update(this.aF1067_TrackingDataSet.tracking_AF1067_fields);
                    MessageBox.Show(new_tracking_AF1067_fieldsRow.LeadCommandControlNo, "New AF1067 row saved!");

                    //Allocate new row in tracking_nonAF1067_fields
                    New_AF1067_TrackingDataSet.tracking_non_AF1067_fieldsRow new_tracking_nonAF1067_fieldsRow;
                    new_tracking_nonAF1067_fieldsRow = aF1067_TrackingDataSet.tracking_non_AF1067_fields.Newtracking_non_AF1067_fieldsRow();
                    //Set primary key from GUID for tracking_nonAF1067_fields
                    new_tracking_nonAF1067_fieldsRow.PK_nonAF1067 = Guid.NewGuid().ToString();
                    pK_nonAF1067 = new_tracking_nonAF1067_fieldsRow.PK_nonAF1067;
                    //Set foreign key to tracking_AF1067_fields
                    new_tracking_nonAF1067_fieldsRow.FK_AF1067 = new_tracking_AF1067_fieldsRow.PK_AF1067;
                    //Copy data values from window to current tracking_nonAF1067_ fields record
                    new_tracking_nonAF1067_fieldsRow.LeadCommandControlNo = tbLeadCommandControlNo.Text;
                    new_tracking_nonAF1067_fieldsRow.Base = baseTextBox.Text;
                    new_tracking_nonAF1067_fieldsRow.Comments = commentsTextBox.Text;
                    if (dateSentToSSMDatePicker.SelectedDate == null)
                        new_tracking_nonAF1067_fieldsRow.DateSentToSSM = nullDate;
                    else
                        new_tracking_nonAF1067_fieldsRow.DateSentToSSM = dateSentToSSMDatePicker.SelectedDate.Value;
                    new_tracking_nonAF1067_fieldsRow.Part3_Comments = part3_CommentsTextBox.Text;
                    new_tracking_nonAF1067_fieldsRow.Part5_Comments = part5_CommentsTextBox.Text;
                    new_tracking_nonAF1067_fieldsRow.PIWG_AI_No = pIWG_AI_NoTextBox.Text;
                    new_tracking_nonAF1067_fieldsRow.Rack_Stack_No = rack_Stack_NoTextBox.Text;
                    new_tracking_nonAF1067_fieldsRow.IPT_PM_Assigned = iPT_PM_AssignedTextBox.Text;
                    new_tracking_nonAF1067_fieldsRow.TRB_No = tRB_NoTextBox.Text;
                    if (tRB_DateDatePicker.SelectedDate == null)
                        new_tracking_nonAF1067_fieldsRow.TRB_Date = nullDate;
                    else
                        new_tracking_nonAF1067_fieldsRow.TRB_Date = tRB_DateDatePicker.SelectedDate.Value;
                    new_tracking_nonAF1067_fieldsRow.TRB_Comments = "";
                    if (cCB_DateDatePicker.SelectedDate == null)
                        new_tracking_nonAF1067_fieldsRow.CCB_Date = nullDate;
                    else
                        new_tracking_nonAF1067_fieldsRow.CCB_Date = cCB_DateDatePicker.SelectedDate.Value;
                    isNumeric = int.TryParse(tbTotalCost.Text, out n);
                    new_tracking_nonAF1067_fieldsRow.Cost = n;
                    if (modStDatePicker.SelectedDate == null)
                        new_tracking_nonAF1067_fieldsRow.ModSt = nullDate;
                    else
                        new_tracking_nonAF1067_fieldsRow.ModSt = modStDatePicker.SelectedDate.Value;
                    new_tracking_nonAF1067_fieldsRow.ModStComments = null;
                    if (modCompDatePicker.SelectedDate == null)
                        new_tracking_nonAF1067_fieldsRow.ModComp = nullDate;
                    else
                        new_tracking_nonAF1067_fieldsRow.ModComp = modCompDatePicker.SelectedDate.Value;
                    new_tracking_nonAF1067_fieldsRow.ModCompComments = null;
                    new_tracking_nonAF1067_fieldsRow.StatusPerSSM = statusPerSSMTextBox.Text;
                    new_tracking_nonAF1067_fieldsRow.F27 = f27TextBox.Text;
                    // Add the row to the tracking_nonAF1067_fields table
                    this.aF1067_TrackingDataSet.tracking_non_AF1067_fields.Rows.Add(new_tracking_nonAF1067_fieldsRow);
                    // Save the new row to the database
                    this.ta_tracking_non_AF1067_fields.Update(aF1067_TrackingDataSet.tracking_non_AF1067_fields);
                }

    Thursday, September 28, 2017 7:44 PM
  •             else
                {
                    //* * * * * * * * * * * * * * * * * * * * E X I S T I N G   R E C O R D * * * * * * * * * * * * * * * * * * * *
                    MessageBoxResult messageBoxResult = MessageBox.Show("Do you wish to update?", "Record already exists!", MessageBoxButton.YesNo);
                    if (messageBoxResult == MessageBoxResult.Yes)
                    {
                        //* * * * * * * * * * * * * * * * * * F I N D   D E S I R E D   R O W * * * * * * * * * * * * * * * * * * *
                        New_AF1067_TrackingDataSet.tracking_AF1067_fieldsRow new_tracking_AF1067_fieldsRow = aF1067_TrackingDataSet.tracking_AF1067_fields.FindByLeadCommandControlNo(tbLeadCommandControlNo.Text);
                        //* * * * * * * * * * S T O R E   N E W   O R   U N C H A N G E D   R O W   V A L U E S * * * * * * * * * *
                        //* * * * * * * * * * * * * * * * H E A D E R   A N D   K E Y   V A L U E S * * * * * * * * * * * * * * * *
                        new_tracking_AF1067_fieldsRow.LeadCommandControlNo = tbLeadCommandControlNo.Text;
                        //* * * * * * * * * * * * * * * * * * * * P A R T   I   V A L U E S * * * * * * * * * * * * * * * * * * * *
                        if (proposalDateDatePicker.SelectedDate != null)
                            new_tracking_AF1067_fieldsRow.ProposalDate = proposalDateDatePicker.SelectedDate.Value;
                        else
                            new_tracking_AF1067_fieldsRow.ProposalDate = nullDate;
                        new_tracking_AF1067_fieldsRow.Initiator = initiatorTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Org = orgTextBox.Text;
                        new_tracking_AF1067_fieldsRow.POC_ValidatedBy = pOC_ValidatedByTextBox.Text;
                        new_tracking_AF1067_fieldsRow.ModTitle = tbModTitle.Text;
                        new_tracking_AF1067_fieldsRow.OrgControlNo = tbOrgControlNo.Text;
                        new_tracking_AF1067_fieldsRow.OtherNumbers = tbOtherNumbers.Text;
                        new_tracking_AF1067_fieldsRow.MDS = tbMDS.Text;
                        new_tracking_AF1067_fieldsRow.WUC = tbWUC.Text;
                        new_tracking_AF1067_fieldsRow.NSN = tbNSN.Text;
                        new_tracking_AF1067_fieldsRow.SRD = tbSRD.Text;
                        new_tracking_AF1067_fieldsRow.OTHER = tbOTHER.Text;
                        new_tracking_AF1067_fieldsRow.NOUN = tbNOUN.Text;
                        new_tracking_AF1067_fieldsRow.Comments = commentsTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Purpose = tbPurpose.Text;
                        new_tracking_AF1067_fieldsRow.Impact = tbImpact.Text;
                        new_tracking_AF1067_fieldsRow.Constraints = tbConstraints.Text;
                        if (dateRecvdInAFFSADatePicker.SelectedDate != null)
                            new_tracking_AF1067_fieldsRow.DateRecvdInAFFSA = dateRecvdInAFFSADatePicker.SelectedDate.Value;
                        else
                            new_tracking_AF1067_fieldsRow.DateRecvdInAFFSA = nullDate;
                        try
                        {
                            if (!Convert.IsDBNull(new_tracking_AF1067_fieldsRow.Part1_Validation))
                            {
                                if (chkOrgVal_A.IsChecked == true || rdoOrgVal_A.IsChecked == true || new_tracking_AF1067_fieldsRow.Part1_Validation == "A")
                                {
                                    new_tracking_AF1067_fieldsRow.Part1_Validation = "A";
                                    chkOrgVal_A.IsChecked = true;
                                    rdoOrgVal_A.IsChecked = true;
                                    //MessageBox.Show("OrgVal A is checked!");
                                }
                                else
                                if (chkOrgVal_B.IsChecked == true || rdoOrgVal_B.IsChecked == true || new_tracking_AF1067_fieldsRow.Part1_Validation == "B")
                                {
                                    new_tracking_AF1067_fieldsRow.Part1_Validation = "B";
                                    chkOrgVal_B.IsChecked = true;
                                    rdoOrgVal_B.IsChecked = true;
                                    //MessageBox.Show("OrgVal B is checked!");
                                }
                                else
                                if (chkOrgVal_C.IsChecked == true || rdoOrgVal_C.IsChecked == true || new_tracking_AF1067_fieldsRow.Part1_Validation == "C")
                                {
                                    new_tracking_AF1067_fieldsRow.Part1_Validation = "C";
                                    chkOrgVal_C.IsChecked = true;
                                    rdoOrgVal_C.IsChecked = true;
                                    //MessageBox.Show("OrgVal C is checked!");
                                }
                                else
                                {
                                    new_tracking_AF1067_fieldsRow.Part1_Validation = "";
                                    MessageBox.Show("No boxes are checked for Part I Validation!");
                                }
                            }
                        }
                        catch
                        {
                            new_tracking_AF1067_fieldsRow.Part1_Validation = "";
                            MessageBox.Show("Error saving Part1_Validation from OrgVal in existing record!");
                        }
    Thursday, September 28, 2017 7:45 PM
  •                     new_tracking_AF1067_fieldsRow.Part1_Name = part12_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part1_Grade = part12_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part1_Title = part12_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part1_DSN = part12_DSNTextBox.Text;
                        if (part12_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part1_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part1_Date = part12_DateDatePicker.SelectedDate.Value;
                        //MessageBox.Show("Part I field values verified or changed in current new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        //* * * * * * * * * * * * * * * * E N D   O F   P A R T   I   V A L U E S * * * * * * * * * * * * * * * * *
                        //* * * * * * * * * * * * * * * * * * * * P A R T   I I   V A L U E S * * * * * * * * * * * * * * * * * * *
                        if (pt2DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt2DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt2DateRecvd = pt2DateRecvdDatePicker.SelectedDate.Value;
                        try
                        {
                            if (rdoUsingCmdVal_A.IsChecked == true || chkUsingCmdVal_A.IsChecked == true || new_tracking_AF1067_fieldsRow.UsingCommandVal == "A")
                            {
                                rdoUsingCmdVal_A.IsChecked = true;
                                chkUsingCmdVal_A.IsChecked = true;
                                new_tracking_AF1067_fieldsRow.UsingCommandVal = "A";
                            }
                            else
                            if (rdoUsingCmdVal_B.IsChecked == true || chkUsingCmdVal_B.IsChecked == true || new_tracking_AF1067_fieldsRow.UsingCommandVal == "B")
                            {
                                rdoUsingCmdVal_B.IsChecked = true;
                                chkUsingCmdVal_B.IsChecked = true;
                                new_tracking_AF1067_fieldsRow.UsingCommandVal = "B";
                            }
                            else
                            if (rdoUsingCmdVal_C.IsChecked == true || chkUsingCmdVal_C.IsChecked == true || new_tracking_AF1067_fieldsRow.UsingCommandVal == "C")
                            {
                                rdoUsingCmdVal_C.IsChecked = true;
                                chkUsingCmdVal_C.IsChecked = true;
                                new_tracking_AF1067_fieldsRow.UsingCommandVal = "C";
                            }
                            else
                            if (rdoUsingCmdVal_D.IsChecked == true || chkUsingCmdVal_D.IsChecked == true || new_tracking_AF1067_fieldsRow.UsingCommandVal == "D")
                            {
                                rdoUsingCmdVal_D.IsChecked = true;
                                chkUsingCmdVal_D.IsChecked = true;
                                new_tracking_AF1067_fieldsRow.UsingCommandVal = "D";
                            }
                            else
                                new_tracking_AF1067_fieldsRow.UsingCommandVal = "";
                        }
                        catch
                        {
                            new_tracking_AF1067_fieldsRow.UsingCommandVal = "";
                        }
                        new_tracking_AF1067_fieldsRow.Part2_Name = part2_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part2_Grade = part2_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part2_Title = part2_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part2_DSN = part2_DSNTextBox.Text;
                        if (part2_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part2_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part2_Date = part2_DateDatePicker.SelectedDate.Value;
                        try
                        {
                            new_tracking_AF1067_fieldsRow.Part2_Validation = new_tracking_AF1067_fieldsRow.UsingCommandVal;
                        }
                        catch
                        {
                            new_tracking_AF1067_fieldsRow.UsingCommandVal = "";
                            new_tracking_AF1067_fieldsRow.Part2_Validation = "";
                        }
                        new_tracking_AF1067_fieldsRow.UsingCommandControlNo = tbUsingCommandControlNo.Text;
                        //MessageBox.Show("Part II field values verified or changed in current record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        //* * * * * * * * * * * * * * * * * E N D   O F   P A R T   I I   V A L U E S * * * * * * * * * * * * * * * *
    Thursday, September 28, 2017 7:46 PM
  •                     //* * * * * * * * * * * * * * * * * * * * P A R T   I I I   V A L U E S * * * * * * * * * * * * * * * * * * *
                        if (rdoLeadCommandVal_A.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "A";
                        else
                        if (rdoLeadCommandVal_B.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "B";
                        else
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "";
                        new_tracking_AF1067_fieldsRow.Part3_Name = part3_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_Grade = part3_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_Title = part3_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_DSN = part3_DSNTextBox.Text;
                        if (part3_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part3_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part3_Date = part3_DateDatePicker.SelectedDate.Value;
                        if (pt3DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt3DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt3DateRecvd = pt3DateRecvdDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.LeadCommand_AO = leadCommand_AO_TextBox.Text;
                        new_tracking_AF1067_fieldsRow.OptionalRouting = optionalRoutingTextBox.Text;
                        new_tracking_AF1067_fieldsRow.SingleManagerOffice = singleManagerOfficeTextBox.Text;
                        try
                        {
                            if (rdoT_1.IsChecked == true || chkT_1.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "1")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "1";
                                rdoT_1.IsChecked = true;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = true;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoT_2.IsChecked == true || chkT_2.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "2")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "2";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = true;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = true;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoP.IsChecked == true || chkPermanent.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "P")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "P";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = true;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = true;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoS.IsChecked == true || chkSafety.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "S")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "S";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = true;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = true;
                            }
                            else
                                new_tracking_AF1067_fieldsRow.ModType = "";
                        }
                        catch
                        {
                            new_tracking_AF1067_fieldsRow.ModType = "";
                        }
                        new_tracking_AF1067_fieldsRow.Lead_Command_Remarks = leadCommandRemarksTextBox.Text;
                        if (rdoLeadCommandVal_A.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Lead_Command_Val = true;
                        else
                            new_tracking_AF1067_fieldsRow.Lead_Command_Val = false;
                        //MessageBox.Show("Part III field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        if (pt4DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt4DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt4DateRecvd = pt4DateRecvdDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.Single_Manager_AO = single_Manager_AOTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Center_MIP_No = center_MIP_NoTextBox.Text;
                        new_tracking_AF1067_fieldsRow.ECP_No = eCP_NoTextBox.Text;
                        new_tracking_AF1067_fieldsRow.TCTO_No = tCTO_NoTextBox.Text;
                        float nfloat;
                        bool isNumeric = float.TryParse(tbTotal_BP_EEIC.Text, out nfloat);
                        new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(nfloat);
                        int n;
                        isNumeric = int.TryParse(tbNr_of_CIS_Affected.Text, out n);
                        new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                        isNumeric = int.TryParse(tbTotal_Kits_Needed.Text, out n);
                        new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                        isNumeric = int.TryParse(tbWorkHours_User.Text, out n);
                        new_tracking_AF1067_fieldsRow.WorkHours_User = n;
                        isNumeric = int.TryParse(tbWorkHours_Depot.Text, out n);
                        new_tracking_AF1067_fieldsRow.WorkHours_Depot = n;
                        new_tracking_AF1067_fieldsRow.Part4_Name = part4_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_Grade = part4_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_Title = part4_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_DSN = part4_DSNTextBox.Text;
                        if (part4_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part4_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part4_Date = part4_DateDatePicker.SelectedDate.Value;
                        decimal nDec;
                        try
                        {
                            isNumeric = decimal.TryParse(total_BP_EEICTextBox.Text, out nDec);
                            new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(total_BP_EEICTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("Total_BP_EEIC not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.Total_BP_EEIC));
                            new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(0.0);
                        }
                        try
                        {
                            isNumeric = int.TryParse(nR_of_CIS_AffectedTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                        }
                        catch
                        {
                            MessageBox.Show("nR_of_CIS_Affected not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected));
                            new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = Convert.ToInt32(0.0);
                        }
                        try
                        {
                            isNumeric = int.TryParse(total_Kits_NeededTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                        }
                        catch
                        {
                            MessageBox.Show("total_Kits_Needed not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.Total_Kits_Needed));
                            new_tracking_AF1067_fieldsRow.Total_Kits_Needed = 0;
                        }
                        try
                        {
                            isNumeric = int.TryParse(workHours_UserTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.WorkHours_User = Convert.ToInt32(workHours_UserTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("workHours_User not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.WorkHours_User));
                            new_tracking_AF1067_fieldsRow.WorkHours_User = 0;
                        }
                        try
                        {
                            isNumeric = int.TryParse(workHours_DepotTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.WorkHours_Depot = Convert.ToInt32(workHours_DepotTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("workHours_Depot not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.WorkHours_Depot));
                            new_tracking_AF1067_fieldsRow.WorkHours_Depot = 0;
                        }
                        //MessageBox.Show("Part IV field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        if (rdoTemporary.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "T";
                        else
                        if (rdoDisapprove.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "D";
                        else
                        if (rdoPermanent.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "P";
                        else
                        if (rdoMNS_ORD.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "M";
                        else
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "";
                        new_tracking_AF1067_fieldsRow.Part4_Comments = part4_CommentsTextBo.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Name = part5_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Grade = part5_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Title = part5_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_DSN = part5_DSNTextBox.Text;
                        if (part5_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part5_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part5_Date = part5_DateDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.SupportEquipAff = Convert.ToBoolean(supportEquipAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.AircrewTrainingAff = Convert.ToBoolean(aircrewTrainingAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.TrainingDev_AidsAff = Convert.ToBoolean(trainingDev_AidsAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.TechDataAff = Convert.ToBoolean(techDataAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.SparesAff = Convert.ToBoolean(sparesAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.SoftwareAff = Convert.ToBoolean(softwareAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.OtherAff = Convert.ToBoolean(otherAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.OtherAff_Spec = otherAff_SpecTextBox.Text;
                        isNumeric = decimal.TryParse(kit_UnitCostTextBox.Text, out nDec);
                        new_tracking_AF1067_fieldsRow.Kit_UnitCost = nDec;
                        isNumeric = decimal.TryParse(totalCostTextBox.Text, out nDec);
                        new_tracking_AF1067_fieldsRow.TotalCost = nDec;
                        new_tracking_AF1067_fieldsRow.LeadTime = leadTimeTextBox.Text;
                        if (installBeginDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.InstallBegin = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.InstallBegin = installBeginDatePicker.SelectedDate.Value;
                        if (installComplDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.InstallCompl = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.InstallCompl = installComplDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_User = Convert.ToBoolean(levelOfAccomp_UserCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Depot = Convert.ToBoolean(levelOfAccomp_DepotCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Both = Convert.ToBoolean(levelOfAccomp_BothCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Other = Convert.ToBoolean(levelOfAccomp_OtherCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.Manufacturer = manufacturerTextBox.Text;
                        new_tracking_AF1067_fieldsRow.AC_Breakout = aC_BreakoutTextBox.Text;
                        new_tracking_AF1067_fieldsRow.EngRev_Recommendations = engRev_RecommendationsTextBox.Text;
                        if (rdoSSM_Approved.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.SSM_Approved = true;
                        else
                            new_tracking_AF1067_fieldsRow.SSM_Approved = false;
                        if(dateSentToSSMDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = dateSentToSSMDatePicker.SelectedDate.Value;
                        //MessageBox.Show("Part V field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        try
                        {
                            // Update the row in the tracking_AF1067_fields table
                            this.ta_tracking_AF1067_fields.Update(this.aF1067_TrackingDataSet.tracking_AF1067_fields);
                            MessageBox.Show("AF1067 Row updated!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        }
                        catch
                        {
                            MessageBox.Show("OOPS!  ...AF1067 Row update Didn't work!!!!!");
                        }
    Thursday, September 28, 2017 7:49 PM
  •                     //* * * * * * * * * * * * * * * * * * * * P A R T   I I I   V A L U E S * * * * * * * * * * * * * * * * * * *
                        if (rdoLeadCommandVal_A.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "A";
                        else
                        if (rdoLeadCommandVal_B.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "B";
                        else
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "";
                        new_tracking_AF1067_fieldsRow.Part3_Name = part3_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_Grade = part3_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_Title = part3_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_DSN = part3_DSNTextBox.Text;
                        if (part3_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part3_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part3_Date = part3_DateDatePicker.SelectedDate.Value;
                        if (pt3DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt3DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt3DateRecvd = pt3DateRecvdDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.LeadCommand_AO = leadCommand_AO_TextBox.Text;
                        new_tracking_AF1067_fieldsRow.OptionalRouting = optionalRoutingTextBox.Text;
                        new_tracking_AF1067_fieldsRow.SingleManagerOffice = singleManagerOfficeTextBox.Text;
                        try
                        {
                            if (rdoT_1.IsChecked == true || chkT_1.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "1")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "1";
                                rdoT_1.IsChecked = true;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = true;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoT_2.IsChecked == true || chkT_2.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "2")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "2";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = true;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = true;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoP.IsChecked == true || chkPermanent.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "P")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "P";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = true;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = true;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoS.IsChecked == true || chkSafety.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "S")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "S";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = true;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = true;
                            }
                            else
                                new_tracking_AF1067_fieldsRow.ModType = "";
                        }
                        catch
                        {
                            new_tracking_AF1067_fieldsRow.ModType = "";
                        }
                        new_tracking_AF1067_fieldsRow.Lead_Command_Remarks = leadCommandRemarksTextBox.Text;
                        if (rdoLeadCommandVal_A.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Lead_Command_Val = true;
                        else
                            new_tracking_AF1067_fieldsRow.Lead_Command_Val = false;
                        //MessageBox.Show("Part III field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        if (pt4DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt4DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt4DateRecvd = pt4DateRecvdDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.Single_Manager_AO = single_Manager_AOTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Center_MIP_No = center_MIP_NoTextBox.Text;
                        new_tracking_AF1067_fieldsRow.ECP_No = eCP_NoTextBox.Text;
                        new_tracking_AF1067_fieldsRow.TCTO_No = tCTO_NoTextBox.Text;
                        float nfloat;
                        bool isNumeric = float.TryParse(tbTotal_BP_EEIC.Text, out nfloat);
                        new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(nfloat);
                        int n;
                        isNumeric = int.TryParse(tbNr_of_CIS_Affected.Text, out n);
                        new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                        isNumeric = int.TryParse(tbTotal_Kits_Needed.Text, out n);
                        new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                        isNumeric = int.TryParse(tbWorkHours_User.Text, out n);
                        new_tracking_AF1067_fieldsRow.WorkHours_User = n;
                        isNumeric = int.TryParse(tbWorkHours_Depot.Text, out n);
                        new_tracking_AF1067_fieldsRow.WorkHours_Depot = n;
                        new_tracking_AF1067_fieldsRow.Part4_Name = part4_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_Grade = part4_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_Title = part4_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_DSN = part4_DSNTextBox.Text;
                        if (part4_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part4_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part4_Date = part4_DateDatePicker.SelectedDate.Value;
                        decimal nDec;
                        try
                        {
                            isNumeric = decimal.TryParse(total_BP_EEICTextBox.Text, out nDec);
                            new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(total_BP_EEICTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("Total_BP_EEIC not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.Total_BP_EEIC));
                            new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(0.0);
                        }
                        try
                        {
                            isNumeric = int.TryParse(nR_of_CIS_AffectedTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                        }
                        catch
                        {
                            MessageBox.Show("nR_of_CIS_Affected not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected));
                            new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = Convert.ToInt32(0.0);
                        }
                        try
                        {
                            isNumeric = int.TryParse(total_Kits_NeededTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                        }
                        catch
                        {
                            MessageBox.Show("total_Kits_Needed not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.Total_Kits_Needed));
                            new_tracking_AF1067_fieldsRow.Total_Kits_Needed = 0;
                        }
                        try
                        {
                            isNumeric = int.TryParse(workHours_UserTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.WorkHours_User = Convert.ToInt32(workHours_UserTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("workHours_User not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.WorkHours_User));
                            new_tracking_AF1067_fieldsRow.WorkHours_User = 0;
                        }
                        try
                        {
                            isNumeric = int.TryParse(workHours_DepotTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.WorkHours_Depot = Convert.ToInt32(workHours_DepotTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("workHours_Depot not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.WorkHours_Depot));
                            new_tracking_AF1067_fieldsRow.WorkHours_Depot = 0;
                        }
                        //MessageBox.Show("Part IV field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        if (rdoTemporary.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "T";
                        else
                        if (rdoDisapprove.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "D";
                        else
                        if (rdoPermanent.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "P";
                        else
                        if (rdoMNS_ORD.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "M";
                        else
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "";
                        new_tracking_AF1067_fieldsRow.Part4_Comments = part4_CommentsTextBo.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Name = part5_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Grade = part5_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Title = part5_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_DSN = part5_DSNTextBox.Text;
                        if (part5_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part5_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part5_Date = part5_DateDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.SupportEquipAff = Convert.ToBoolean(supportEquipAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.AircrewTrainingAff = Convert.ToBoolean(aircrewTrainingAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.TrainingDev_AidsAff = Convert.ToBoolean(trainingDev_AidsAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.TechDataAff = Convert.ToBoolean(techDataAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.SparesAff = Convert.ToBoolean(sparesAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.SoftwareAff = Convert.ToBoolean(softwareAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.OtherAff = Convert.ToBoolean(otherAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.OtherAff_Spec = otherAff_SpecTextBox.Text;
                        isNumeric = decimal.TryParse(kit_UnitCostTextBox.Text, out nDec);
                        new_tracking_AF1067_fieldsRow.Kit_UnitCost = nDec;
                        isNumeric = decimal.TryParse(totalCostTextBox.Text, out nDec);
                        new_tracking_AF1067_fieldsRow.TotalCost = nDec;
                        new_tracking_AF1067_fieldsRow.LeadTime = leadTimeTextBox.Text;
                        if (installBeginDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.InstallBegin = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.InstallBegin = installBeginDatePicker.SelectedDate.Value;
                        if (installComplDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.InstallCompl = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.InstallCompl = installComplDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_User = Convert.ToBoolean(levelOfAccomp_UserCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Depot = Convert.ToBoolean(levelOfAccomp_DepotCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Both = Convert.ToBoolean(levelOfAccomp_BothCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Other = Convert.ToBoolean(levelOfAccomp_OtherCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.Manufacturer = manufacturerTextBox.Text;
                        new_tracking_AF1067_fieldsRow.AC_Breakout = aC_BreakoutTextBox.Text;
                        new_tracking_AF1067_fieldsRow.EngRev_Recommendations = engRev_RecommendationsTextBox.Text;
                        if (rdoSSM_Approved.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.SSM_Approved = true;
                        else
                            new_tracking_AF1067_fieldsRow.SSM_Approved = false;
                        if(dateSentToSSMDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = dateSentToSSMDatePicker.SelectedDate.Value;
                        //MessageBox.Show("Part V field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        try
                        {
                            // Update the row in the tracking_AF1067_fields table
                            this.ta_tracking_AF1067_fields.Update(this.aF1067_TrackingDataSet.tracking_AF1067_fields);
                            MessageBox.Show("AF1067 Row updated!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        }
                        catch
                        {
                            MessageBox.Show("OOPS!  ...AF1067 Row update Didn't work!!!!!");
                        }
    Thursday, September 28, 2017 7:51 PM
  •                     //* * * * * * * * * * * * * * * * * * * * P A R T   I I I   V A L U E S * * * * * * * * * * * * * * * * * * *
                        if (rdoLeadCommandVal_A.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "A";
                        else
                        if (rdoLeadCommandVal_B.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "B";
                        else
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "";
                        new_tracking_AF1067_fieldsRow.Part3_Name = part3_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_Grade = part3_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_Title = part3_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_DSN = part3_DSNTextBox.Text;
                        if (part3_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part3_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part3_Date = part3_DateDatePicker.SelectedDate.Value;
                        if (pt3DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt3DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt3DateRecvd = pt3DateRecvdDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.LeadCommand_AO = leadCommand_AO_TextBox.Text;
                        new_tracking_AF1067_fieldsRow.OptionalRouting = optionalRoutingTextBox.Text;
                        new_tracking_AF1067_fieldsRow.SingleManagerOffice = singleManagerOfficeTextBox.Text;
                        try
                        {
                            if (rdoT_1.IsChecked == true || chkT_1.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "1")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "1";
                                rdoT_1.IsChecked = true;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = true;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoT_2.IsChecked == true || chkT_2.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "2")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "2";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = true;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = true;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoP.IsChecked == true || chkPermanent.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "P")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "P";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = true;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = true;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoS.IsChecked == true || chkSafety.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "S")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "S";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = true;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = true;
                            }
                            else
                                new_tracking_AF1067_fieldsRow.ModType = "";
                        }
                        catch
                        {
                            new_tracking_AF1067_fieldsRow.ModType = "";
                        }
                        new_tracking_AF1067_fieldsRow.Lead_Command_Remarks = leadCommandRemarksTextBox.Text;
                        if (rdoLeadCommandVal_A.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Lead_Command_Val = true;
                        else
                            new_tracking_AF1067_fieldsRow.Lead_Command_Val = false;
                        //MessageBox.Show("Part III field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        if (pt4DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt4DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt4DateRecvd = pt4DateRecvdDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.Single_Manager_AO = single_Manager_AOTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Center_MIP_No = center_MIP_NoTextBox.Text;
                        new_tracking_AF1067_fieldsRow.ECP_No = eCP_NoTextBox.Text;
                        new_tracking_AF1067_fieldsRow.TCTO_No = tCTO_NoTextBox.Text;
                        float nfloat;
                        bool isNumeric = float.TryParse(tbTotal_BP_EEIC.Text, out nfloat);
                        new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(nfloat);
                        int n;
                        isNumeric = int.TryParse(tbNr_of_CIS_Affected.Text, out n);
                        new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                        isNumeric = int.TryParse(tbTotal_Kits_Needed.Text, out n);
                        new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                        isNumeric = int.TryParse(tbWorkHours_User.Text, out n);
                        new_tracking_AF1067_fieldsRow.WorkHours_User = n;
                        isNumeric = int.TryParse(tbWorkHours_Depot.Text, out n);
                        new_tracking_AF1067_fieldsRow.WorkHours_Depot = n;
                        new_tracking_AF1067_fieldsRow.Part4_Name = part4_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_Grade = part4_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_Title = part4_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_DSN = part4_DSNTextBox.Text;
                        if (part4_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part4_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part4_Date = part4_DateDatePicker.SelectedDate.Value;
                        decimal nDec;
                        try
                        {
                            isNumeric = decimal.TryParse(total_BP_EEICTextBox.Text, out nDec);
                            new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(total_BP_EEICTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("Total_BP_EEIC not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.Total_BP_EEIC));
                            new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(0.0);
                        }
                        try
                        {
                            isNumeric = int.TryParse(nR_of_CIS_AffectedTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                        }
                        catch
                        {
                            MessageBox.Show("nR_of_CIS_Affected not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected));
                            new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = Convert.ToInt32(0.0);
                        }
                        try
                        {
                            isNumeric = int.TryParse(total_Kits_NeededTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                        }
                        catch
                        {
                            MessageBox.Show("total_Kits_Needed not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.Total_Kits_Needed));
                            new_tracking_AF1067_fieldsRow.Total_Kits_Needed = 0;
                        }
                        try
                        {
                            isNumeric = int.TryParse(workHours_UserTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.WorkHours_User = Convert.ToInt32(workHours_UserTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("workHours_User not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.WorkHours_User));
                            new_tracking_AF1067_fieldsRow.WorkHours_User = 0;
                        }
                        try
                        {
                            isNumeric = int.TryParse(workHours_DepotTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.WorkHours_Depot = Convert.ToInt32(workHours_DepotTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("workHours_Depot not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.WorkHours_Depot));
                            new_tracking_AF1067_fieldsRow.WorkHours_Depot = 0;
                        }
                        //MessageBox.Show("Part IV field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        if (rdoTemporary.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "T";
                        else
                        if (rdoDisapprove.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "D";
                        else
                        if (rdoPermanent.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "P";
                        else
                        if (rdoMNS_ORD.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "M";
                        else
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "";
                        new_tracking_AF1067_fieldsRow.Part4_Comments = part4_CommentsTextBo.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Name = part5_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Grade = part5_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Title = part5_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_DSN = part5_DSNTextBox.Text;
                        if (part5_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part5_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part5_Date = part5_DateDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.SupportEquipAff = Convert.ToBoolean(supportEquipAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.AircrewTrainingAff = Convert.ToBoolean(aircrewTrainingAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.TrainingDev_AidsAff = Convert.ToBoolean(trainingDev_AidsAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.TechDataAff = Convert.ToBoolean(techDataAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.SparesAff = Convert.ToBoolean(sparesAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.SoftwareAff = Convert.ToBoolean(softwareAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.OtherAff = Convert.ToBoolean(otherAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.OtherAff_Spec = otherAff_SpecTextBox.Text;
                        isNumeric = decimal.TryParse(kit_UnitCostTextBox.Text, out nDec);
                        new_tracking_AF1067_fieldsRow.Kit_UnitCost = nDec;
                        isNumeric = decimal.TryParse(totalCostTextBox.Text, out nDec);
                        new_tracking_AF1067_fieldsRow.TotalCost = nDec;
                        new_tracking_AF1067_fieldsRow.LeadTime = leadTimeTextBox.Text;
                        if (installBeginDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.InstallBegin = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.InstallBegin = installBeginDatePicker.SelectedDate.Value;
                        if (installComplDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.InstallCompl = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.InstallCompl = installComplDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_User = Convert.ToBoolean(levelOfAccomp_UserCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Depot = Convert.ToBoolean(levelOfAccomp_DepotCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Both = Convert.ToBoolean(levelOfAccomp_BothCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Other = Convert.ToBoolean(levelOfAccomp_OtherCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.Manufacturer = manufacturerTextBox.Text;
                        new_tracking_AF1067_fieldsRow.AC_Breakout = aC_BreakoutTextBox.Text;
                        new_tracking_AF1067_fieldsRow.EngRev_Recommendations = engRev_RecommendationsTextBox.Text;
                        if (rdoSSM_Approved.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.SSM_Approved = true;
                        else
                            new_tracking_AF1067_fieldsRow.SSM_Approved = false;
                        if(dateSentToSSMDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = dateSentToSSMDatePicker.SelectedDate.Value;
                        //MessageBox.Show("Part V field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        try
                        {
                            // Update the row in the tracking_AF1067_fields table
                            this.ta_tracking_AF1067_fields.Update(this.aF1067_TrackingDataSet.tracking_AF1067_fields);
                            MessageBox.Show("AF1067 Row updated!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        }
                        catch
                        {
                            MessageBox.Show("OOPS!  ...AF1067 Row update Didn't work!!!!!");
                        }
    Thursday, September 28, 2017 7:53 PM
  •                     //* * * * * * * * * * * * * * * * * * * * P A R T   I I I   V A L U E S * * * * * * * * * * * * * * * * * * *
                        if (rdoLeadCommandVal_A.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "A";
                        else
                        if (rdoLeadCommandVal_B.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "B";
                        else
                            new_tracking_AF1067_fieldsRow.LeadCommandVal_A_or_B = "";
                        new_tracking_AF1067_fieldsRow.Part3_Name = part3_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_Grade = part3_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_Title = part3_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part3_DSN = part3_DSNTextBox.Text;
                        if (part3_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part3_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part3_Date = part3_DateDatePicker.SelectedDate.Value;
                        if (pt3DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt3DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt3DateRecvd = pt3DateRecvdDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.LeadCommand_AO = leadCommand_AO_TextBox.Text;
                        new_tracking_AF1067_fieldsRow.OptionalRouting = optionalRoutingTextBox.Text;
                        new_tracking_AF1067_fieldsRow.SingleManagerOffice = singleManagerOfficeTextBox.Text;
                        try
                        {
                            if (rdoT_1.IsChecked == true || chkT_1.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "1")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "1";
                                rdoT_1.IsChecked = true;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = true;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoT_2.IsChecked == true || chkT_2.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "2")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "2";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = true;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = true;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoP.IsChecked == true || chkPermanent.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "P")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "P";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = true;
                                rdoS.IsChecked = false;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = true;
                                chkSafety.IsChecked = false;
                            }
                            else
                            if (rdoS.IsChecked == true || chkSafety.IsChecked == true || new_tracking_AF1067_fieldsRow.ModType == "S")
                            {
                                new_tracking_AF1067_fieldsRow.ModType = "S";
                                rdoT_1.IsChecked = false;
                                rdoT_2.IsChecked = false;
                                rdoP.IsChecked = false;
                                rdoS.IsChecked = true;
                                chkT_1.IsChecked = false;
                                chkT_2.IsChecked = false;
                                chkPermanent.IsChecked = false;
                                chkSafety.IsChecked = true;
                            }
                            else
                                new_tracking_AF1067_fieldsRow.ModType = "";
                        }
                        catch
                        {
                            new_tracking_AF1067_fieldsRow.ModType = "";
                        }
                        new_tracking_AF1067_fieldsRow.Lead_Command_Remarks = leadCommandRemarksTextBox.Text;
                        if (rdoLeadCommandVal_A.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Lead_Command_Val = true;
                        else
                            new_tracking_AF1067_fieldsRow.Lead_Command_Val = false;
                        //MessageBox.Show("Part III field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        if (pt4DateRecvdDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Pt4DateRecvd = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Pt4DateRecvd = pt4DateRecvdDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.Single_Manager_AO = single_Manager_AOTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Center_MIP_No = center_MIP_NoTextBox.Text;
                        new_tracking_AF1067_fieldsRow.ECP_No = eCP_NoTextBox.Text;
                        new_tracking_AF1067_fieldsRow.TCTO_No = tCTO_NoTextBox.Text;
                        float nfloat;
                        bool isNumeric = float.TryParse(tbTotal_BP_EEIC.Text, out nfloat);
                        new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(nfloat);
                        int n;
                        isNumeric = int.TryParse(tbNr_of_CIS_Affected.Text, out n);
                        new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                        isNumeric = int.TryParse(tbTotal_Kits_Needed.Text, out n);
                        new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                        isNumeric = int.TryParse(tbWorkHours_User.Text, out n);
                        new_tracking_AF1067_fieldsRow.WorkHours_User = n;
                        isNumeric = int.TryParse(tbWorkHours_Depot.Text, out n);
                        new_tracking_AF1067_fieldsRow.WorkHours_Depot = n;
                        new_tracking_AF1067_fieldsRow.Part4_Name = part4_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_Grade = part4_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_Title = part4_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part4_DSN = part4_DSNTextBox.Text;
                        if (part4_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part4_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part4_Date = part4_DateDatePicker.SelectedDate.Value;
                        decimal nDec;
                        try
                        {
                            isNumeric = decimal.TryParse(total_BP_EEICTextBox.Text, out nDec);
                            new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(total_BP_EEICTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("Total_BP_EEIC not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.Total_BP_EEIC));
                            new_tracking_AF1067_fieldsRow.Total_BP_EEIC = Convert.ToDecimal(0.0);
                        }
                        try
                        {
                            isNumeric = int.TryParse(nR_of_CIS_AffectedTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = n;
                        }
                        catch
                        {
                            MessageBox.Show("nR_of_CIS_Affected not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected));
                            new_tracking_AF1067_fieldsRow.NR_of_CIS_Affected = Convert.ToInt32(0.0);
                        }
                        try
                        {
                            isNumeric = int.TryParse(total_Kits_NeededTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.Total_Kits_Needed = n;
                        }
                        catch
                        {
                            MessageBox.Show("total_Kits_Needed not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.Total_Kits_Needed));
                            new_tracking_AF1067_fieldsRow.Total_Kits_Needed = 0;
                        }
                        try
                        {
                            isNumeric = int.TryParse(workHours_UserTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.WorkHours_User = Convert.ToInt32(workHours_UserTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("workHours_User not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.WorkHours_User));
                            new_tracking_AF1067_fieldsRow.WorkHours_User = 0;
                        }
                        try
                        {
                            isNumeric = int.TryParse(workHours_DepotTextBox.Text, out n);
                            new_tracking_AF1067_fieldsRow.WorkHours_Depot = Convert.ToInt32(workHours_DepotTextBox.Text);
                        }
                        catch
                        {
                            MessageBox.Show("workHours_Depot not numeric!", Convert.ToString(new_tracking_AF1067_fieldsRow.WorkHours_Depot));
                            new_tracking_AF1067_fieldsRow.WorkHours_Depot = 0;
                        }
                        //MessageBox.Show("Part IV field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        if (rdoTemporary.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "T";
                        else
                        if (rdoDisapprove.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "D";
                        else
                        if (rdoPermanent.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "P";
                        else
                        if (rdoMNS_ORD.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "M";
                        else
                            new_tracking_AF1067_fieldsRow.Part5_LeadCommandVal_TDP = "";
                        new_tracking_AF1067_fieldsRow.Part4_Comments = part4_CommentsTextBo.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Name = part5_NameTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Grade = part5_GradeTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_Title = part5_TitleTextBox.Text;
                        new_tracking_AF1067_fieldsRow.Part5_DSN = part5_DSNTextBox.Text;
                        if (part5_DateDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.Part5_Date = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.Part5_Date = part5_DateDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.SupportEquipAff = Convert.ToBoolean(supportEquipAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.AircrewTrainingAff = Convert.ToBoolean(aircrewTrainingAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.TrainingDev_AidsAff = Convert.ToBoolean(trainingDev_AidsAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.TechDataAff = Convert.ToBoolean(techDataAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.SparesAff = Convert.ToBoolean(sparesAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.SoftwareAff = Convert.ToBoolean(softwareAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.OtherAff = Convert.ToBoolean(otherAffCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.OtherAff_Spec = otherAff_SpecTextBox.Text;
                        isNumeric = decimal.TryParse(kit_UnitCostTextBox.Text, out nDec);
                        new_tracking_AF1067_fieldsRow.Kit_UnitCost = nDec;
                        isNumeric = decimal.TryParse(totalCostTextBox.Text, out nDec);
                        new_tracking_AF1067_fieldsRow.TotalCost = nDec;
                        new_tracking_AF1067_fieldsRow.LeadTime = leadTimeTextBox.Text;
                        if (installBeginDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.InstallBegin = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.InstallBegin = installBeginDatePicker.SelectedDate.Value;
                        if (installComplDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.InstallCompl = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.InstallCompl = installComplDatePicker.SelectedDate.Value;
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_User = Convert.ToBoolean(levelOfAccomp_UserCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Depot = Convert.ToBoolean(levelOfAccomp_DepotCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Both = Convert.ToBoolean(levelOfAccomp_BothCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.LevelOfAccomp_Other = Convert.ToBoolean(levelOfAccomp_OtherCheckBox.IsChecked);
                        new_tracking_AF1067_fieldsRow.Manufacturer = manufacturerTextBox.Text;
                        new_tracking_AF1067_fieldsRow.AC_Breakout = aC_BreakoutTextBox.Text;
                        new_tracking_AF1067_fieldsRow.EngRev_Recommendations = engRev_RecommendationsTextBox.Text;
                        if (rdoSSM_Approved.IsChecked == true)
                            new_tracking_AF1067_fieldsRow.SSM_Approved = true;
                        else
                            new_tracking_AF1067_fieldsRow.SSM_Approved = false;
                        if(dateSentToSSMDatePicker.SelectedDate == null)
                            new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = nullDate;
                        else
                            new_tracking_AF1067_fieldsRow.SignedCopySentToSSM = dateSentToSSMDatePicker.SelectedDate.Value;
                        //MessageBox.Show("Part V field values copied to new record!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        try
                        {
                            // Update the row in the tracking_AF1067_fields table
                            this.ta_tracking_AF1067_fields.Update(this.aF1067_TrackingDataSet.tracking_AF1067_fields);
                            MessageBox.Show("AF1067 Row updated!", new_tracking_AF1067_fieldsRow.LeadCommandControlNo);
                        }
                        catch
                        {
                            MessageBox.Show("OOPS!  ...AF1067 Row update Didn't work!!!!!");
                        }
    Thursday, September 28, 2017 7:56 PM
  • Whew! That's a lot of code. You'd probably make things a lot easier for yourself if you used databinding. But, that's another issue that we won't get into here.

    I did a Find via Internet Explorer to find all the instances of .Update on this page. There were 6 matches and *one* of them is  *not* in a try/catch!!  I suspect that's your culprit. It is here:

    // Save the new row to the database
                    this.ta_tracking_AF1067_fields.Update(this.aF1067_TrackingDataSet.tracking_AF1067_fields);


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Thursday, September 28, 2017 8:35 PM
  • I would recommend identifying the line of code that causes the app to terminate. This may require some trial and error. A simple method is to use a message box to indicate how much of the code has executed before it terminates. You can also write to the Windows Event Log. You will probably need to repeat this several times until the code has been identified.

    Also, check the Windows Event Log to see if it provides any system error messages related to your program.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, September 29, 2017 2:27 PM
  • That's the perplexing thing.  I do use data binding(maybe with some unnecessary code?)...and the program works perfectly if executed from within Visual Studio 2015...but the exe file that is created with the build performs all of the program's features except add a record.

    Monday, October 2, 2017 2:20 PM
  • The point is that the app crashes, most likely due to an unhandled exception. You have missed putting a try/catch around what looks like the bit of code where you are doing an Update to add a new row. Without handling that exception, you have no way of knowing what is causing that exception. And it's obviously something related to updating existing rows versus adding a new row and something that's different between running in Visual Studio and running the exe. But, again, the only way you're going to find out what the problem is, is to put a try/catch around the bit of code that I indicated earlier.
     

    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Monday, October 2, 2017 3:30 PM