Data Update Problem on one textbox control

HI
I have a weird issue in a VB.Net Windows Forms application I cannot work out.

I have a simple Issues Register Application with a text [Status] Field that uses the variables Open, Closed and On Hold bound to a Textbox Control (TextBox_Status ).

If I manually type in the new variable (Open, Closed and On Hold) into the control when the call the Update procedure the Datatable updates the SQL database and all is good.

It falls apart when I want to use a button to update the TextBox (TextBox_Status) using the following;

Me.TextBox_Status.Text = "Open"

At Runtime when I click the button I can see on the form that the text in TextBox_Status has changed but when I call the Update procedure the Datatable does not try to update the database. No error is raised and through SQL Profiler I can see that no attempt is made to update the SQL database. Its as if the bindingsource does not recognise that the text in the textbox has changed unless I directly type the string into the control.

This seems to be working fine elsewhere in the application so if anyone has any suggestions I would really appreciate it.

Thanks

Matthew

PS: Update Procedure I am using;      
     Try
            Me.IssuesTableAdapter.Connection.ConnectionString = My.Settings.SQLConnectionstring
            Me.Validate()
            Me.IssuesBindingSource.EndEdit()
            Me.IssuesTableAdapter.Update(Me.DataSet2005_Issues_Details.Issues)
            Me.IssuesTableAdapter.Connection.Close()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
mj_stantonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kdwoodCommented:
Greetings MJ,

Try adding this line after you set the text on your button update:

Me.TextBox_Status.Text = "Open"
Me.TextBox_Status.Modified = True  <---  Add this

Regards,

Keith

mj_stantonAuthor Commented:
Hi keith

Thats for the suggestion I added the line but unfortunatly It did not help.

I type the word "open" or "Open" at runtime in and then click save and it works fine. If I use the button click event it does not and then click save and the database is not updated.

The Button Click Event code is below;

    Private Sub UltraButton_Status_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraButton_Status.Click

        If Me.UltraButton_Status.Text = "Close Item" Then
            Me.Closed_DateTextBox.Text = Today
            Me.TextBox_Status.Text = "Closed"
            Me.TextBox_Status.Modified = True
            Me.UltraButton_Status.Text = "Reopen Item"
            Me.UltraButton_Status.Appearance.Image = Me.ImageList1.Images(1)

        ElseIf Me.UltraButton_Status.Text = "Reopen Item" Then
            Me.UltraButton_Status.Text = "Close Item"
            Me.Closed_ByTextBox.Text = ""
            Me.Closed_DateTextBox.Text = ""
            Me.TextBox_Status.Text = "Open"
            Me.TextBox_Status.Modified = True
            Me.UltraButton_Status.Appearance.Image = Me.ImageList1.Images(0)
        End If

    End Sub
mj_stantonAuthor Commented:
That was ment to be Thanks for the suggestion.
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

kdwoodCommented:
Hmm...strange!  Can you post the code that your TableAdapterUpdate is running?

mj_stantonAuthor Commented:

Hi  Keith

Here is the Update Command Text, The relevent field is [Issue Status]. I hope thai is what you wanted.

Thanks

Matthew

UPDATE       Issues
SET                ProjectID = @ProjectID, [Item Type] = @Item_Type, [Issue Statement EN] = @Issue_Statement_EN, [Issue Status] = @Issue_Status,
                         [Closed Date] = @Closed_Date, [Closed By] = @Closed_By, [Creation Date] = @Creation_Date, [Created By] = @Created_By,
                         [Buyer Resolution Owner] = @Buyer_Resolution_Owner, [Translation Required] = @Translation_Required, [Assigned To] = @Assigned_To,
                         [Responsible Org/Client Org] = @p1, [Responsible Org/Client Contact] = @p4, [Responsible Org/Client Contact Email] = @p7, Priority = @Priority,
                         Catagory = @Catagory, [Appear in Programme Level Register] = @Appear_in_Programme_Level_Register, [Venue ID] = @Venue_ID,
                         [Issue Name] = @Issue_Name, [Target Completion Date] = @Target_Completion_Date, [Estimated Completion Date] = @Estimated_Completion_Date,
                         [Completion Notes] = @Completion_Notes, [Internal Task] = @Internal_Task, [Risk Likelihood] = @Risk_Likelihood,
                         [Risk Consequence] = @Risk_Consequence, LastUpdate = @LastUpdate, LastUpdateBy = @LastUpdateBy, LastUpdateDate = @LastUpdateDate,
                         LastUpdateTime = @LastUpdateTime, [Related Contact] = @Related_Contact, [External Intergration Required] = @External_Intergration_Required,
                         ProgressPercentage = @ProgressPercentage, [Planned Cost] = @Planned_Cost, [Actual Cost] = @Actual_Cost, [WBS Code] = @WBS_Code,
                         StartDate = @StartDate, Duration = @Duration, [Duration Notes] = @Duration_Notes, [Duration Type] = @Duration_Type, [Actual Duration] = @Actual_Duration,
                          Deleted = @Deleted, [Cost Currency] = @Cost_Currency, [Assigned By] = @Assigned_By, Issue_Log = @Issue_Log, Issue_Client = @Issue_Client,
                         Priority_Order = @Priority_Order, Issue_Client_Name = @Issue_Client_Name
WHERE        (IssuesID = @Original_IssuesID) AND (@IsNull_ProjectID = 1 AND ProjectID IS NULL OR
                         ProjectID = @Original_ProjectID) AND (@IsNull_Item_Type = 1 AND [Item Type] IS NULL OR
                         [Item Type] = @Original_Item_Type) AND (@IsNull_Issue_Status = 1 AND [Issue Status] IS NULL OR
                         [Issue Status] = @Original_Issue_Status) AND (@IsNull_Closed_Date = 1 AND [Closed Date] IS NULL OR
                         [Closed Date] = @Original_Closed_Date) AND (@IsNull_Closed_By = 1 AND [Closed By] IS NULL OR
                         [Closed By] = @Original_Closed_By) AND (@IsNull_Creation_Date = 1 AND [Creation Date] IS NULL OR
                         [Creation Date] = @Original_Creation_Date) AND (@IsNull_Created_By = 1 AND [Created By] IS NULL OR
                         [Created By] = @Original_Created_By) AND (@IsNull_Buyer_Resolution_Owner = 1 AND [Buyer Resolution Owner] IS NULL OR
                         [Buyer Resolution Owner] = @Original_Buyer_Resolution_Owner) AND (@IsNull_Translation_Required = 1 AND [Translation Required] IS NULL OR
                         [Translation Required] = @Original_Translation_Required) AND (@IsNull_Assigned_To = 1 AND [Assigned To] IS NULL OR
                         [Assigned To] = @Original_Assigned_To) AND (@p3 = 1 AND [Responsible Org/Client Org] IS NULL OR
                         [Responsible Org/Client Org] = @p2) AND (@p6 = 1 AND [Responsible Org/Client Contact] IS NULL OR
                         [Responsible Org/Client Contact] = @p5) AND (@p9 = 1 AND [Responsible Org/Client Contact Email] IS NULL OR
                         [Responsible Org/Client Contact Email] = @p8) AND (@IsNull_Priority = 1 AND Priority IS NULL OR
                         Priority = @Original_Priority) AND (@IsNull_Catagory = 1 AND Catagory IS NULL OR
                         Catagory = @Original_Catagory) AND (@IsNull_Appear_in_Programme_Level_Register = 1 AND [Appear in Programme Level Register] IS NULL OR
                         [Appear in Programme Level Register] = @Original_Appear_in_Programme_Level_Register) AND (@IsNull_Venue_ID = 1 AND [Venue ID] IS NULL OR
                         [Venue ID] = @Original_Venue_ID) AND (@IsNull_Issue_Name = 1 AND [Issue Name] IS NULL OR
                         [Issue Name] = @Original_Issue_Name) AND (@IsNull_Target_Completion_Date = 1 AND [Target Completion Date] IS NULL OR
                         [Target Completion Date] = @Original_Target_Completion_Date) AND (@IsNull_Estimated_Completion_Date = 1 AND [Estimated Completion Date] IS NULL OR
                         [Estimated Completion Date] = @Original_Estimated_Completion_Date) AND (@IsNull_Internal_Task = 1 AND [Internal Task] IS NULL OR
                         [Internal Task] = @Original_Internal_Task) AND (@IsNull_Risk_Likelihood = 1 AND [Risk Likelihood] IS NULL OR
                         [Risk Likelihood] = @Original_Risk_Likelihood) AND (@IsNull_Risk_Consequence = 1 AND [Risk Consequence] IS NULL OR
                         [Risk Consequence] = @Original_Risk_Consequence) AND (@IsNull_LastUpdateBy = 1 AND LastUpdateBy IS NULL OR
                         LastUpdateBy = @Original_LastUpdateBy) AND (@IsNull_LastUpdateDate = 1 AND LastUpdateDate IS NULL OR
                         LastUpdateDate = @Original_LastUpdateDate) AND (@IsNull_LastUpdateTime = 1 AND LastUpdateTime IS NULL OR
                         LastUpdateTime = @Original_LastUpdateTime) AND (@IsNull_Related_Contact = 1 AND [Related Contact] IS NULL OR
                         [Related Contact] = @Original_Related_Contact) AND (@IsNull_External_Intergration_Required = 1 AND [External Intergration Required] IS NULL OR
                         [External Intergration Required] = @Original_External_Intergration_Required) AND (@IsNull_ProgressPercentage = 1 AND ProgressPercentage IS NULL OR
                         ProgressPercentage = @Original_ProgressPercentage) AND (@IsNull_Planned_Cost = 1 AND [Planned Cost] IS NULL OR
                         [Planned Cost] = @Original_Planned_Cost) AND (@IsNull_Actual_Cost = 1 AND [Actual Cost] IS NULL OR
                         [Actual Cost] = @Original_Actual_Cost) AND (@IsNull_WBS_Code = 1 AND [WBS Code] IS NULL OR
                         [WBS Code] = @Original_WBS_Code) AND (@IsNull_StartDate = 1 AND StartDate IS NULL OR
                         StartDate = @Original_StartDate) AND (@IsNull_Duration = 1 AND Duration IS NULL OR
                         Duration = @Original_Duration) AND (@IsNull_Duration_Type = 1 AND [Duration Type] IS NULL OR
                         [Duration Type] = @Original_Duration_Type) AND (@IsNull_Actual_Duration = 1 AND [Actual Duration] IS NULL OR
                         [Actual Duration] = @Original_Actual_Duration) AND (@IsNull_Deleted = 1 AND Deleted IS NULL OR
                         Deleted = @Original_Deleted) AND (@IsNull_Cost_Currency = 1 AND [Cost Currency] IS NULL OR
                         [Cost Currency] = @Original_Cost_Currency) AND (@IsNull_Assigned_By = 1 AND [Assigned By] IS NULL OR
                         [Assigned By] = @Original_Assigned_By) AND (@IsNull_Issue_Client = 1 AND Issue_Client IS NULL OR
                         Issue_Client = @Original_Issue_Client) AND (@IsNull_Priority_Order = 1 AND Priority_Order IS NULL OR
                         Priority_Order = @Original_Priority_Order) AND (@IsNull_Issue_Client_Name = 1 AND Issue_Client_Name IS NULL OR
                         Issue_Client_Name = @Original_Issue_Client_Name)
kdwoodCommented:
I'm not sure what the problem is here.  Maybe someone else can chime in.

Sorry I couldn't be of more help.

Regards,

Keith

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mj_stantonAuthor Commented:
I Recreated the form and the problem went away. I have no idea why.

Thanks for trying

Regards

Matthew
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.