Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27569

VS 2010 Checkbox value not binding unless I activate another control after the checkchange.

$
0
0
I have a checkbox that is bound to a dataview.

When I change the value of the checkbox and click a button, that runs through dataview.endedit, then the .update, it's changes are not saved.

I can get the changes to commit if I change the value of the checkbox field, then activate another control, such as I click on a textbox field that is bound to the same dataview, and then do my .endedit, and .update.

How do I need to handle checkboxes to get this change to update? Is there a common error I'm making?

I'm using Visual Studio 2010, Sql Server 2008, any help would be greatly appreciated. Thank you.

Dataview EndEdit ("SingleLimitUnlimited" is the the value that's not getting updated. If it's checked I'm just nulling out a couple other values.)
Code:

 

Dim i As Integer
        For i = 0 To Me.DataView1.Table.Rows.Count - 1

            If Me.DataView1.Table.Rows(i).Item("SingleLimitUnlimited") = True Then
                Me.DataView1.Table.Rows(i).Item("SingleLimit") = DBNull.Value
                Me.DataView1.Table.Rows(i).Item("SingleMax") = DBNull.Value
            End If

            If Me.DataView1.Table.Rows(i).Item("MarriedLimitUnlimited") = True Then
                Me.DataView1.Table.Rows(i).Item("MarriedLimit") = DBNull.Value
                Me.DataView1.Table.Rows(i).Item("MarriedMax") = DBNull.Value
            End If

            Me.DataView1.Table.Rows(i).EndEdit()
        Next


Code:

     

EmployerPlanDataAdapter.Update(Me.DsEmployerPlan1)


Viewing all articles
Browse latest Browse all 27569

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>