J
John Wynstra
I’m running into a problem with a dataset where the columns are bound to
text boxes on a form. By merely navigating through the records using a
bindingmanagerbase, the rowstate for each row that I navigate through
changes to modified even though I have not edited the data. What would
cause this? I have included the relevant CODE.
'FORM DATASET DECLARED
Friend dsarticlelist As New DataSet()
Friend issue_id As String
Dim bmgrid As BindingManagerBase
'LOAD THE FORM, FILL DATASET, BIND TO CONTROLS
Private Sub frmArticle_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
loadarticles(Me.issue_id)
Me.BindArticleDataSettofields()
bmgrid = BindingContext(Me.dsarticlelist, "ixu_articles")
'Me.loadauthorsubjects(txtArticle_id.Text)
End Sub
Private Sub loadarticles(ByVal i_id As String)
dsarticlelist = ixudata.GetArticles(i_id)
End Sub
'SET ISSUE_ID THAT IS USED TO GET ARTICLES
Public Sub SetIssue_ID(ByVal i_id As String)
Me.issue_id = i_id
End Sub
'BIND DATASET TO CONTROLS
Private Sub BindArticleDataSettofields()
Me.txtTitle.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.title"))
Me.txtSummary.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.summary"))
Me.txtDoc_Type.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.doc_type"))
Me.txtPage.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.page"))
Me.txturl.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.url"))
Me.txtIssue_id.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.issue_id"))
Me.txtArticle_id.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.article_id"))
End Sub
'MOVE FORWARD THROUGH DATASET
Private Sub MoveNext()
Me.bmgrid.Position += 1
End Sub
'MOVE BACKWARD THROUGH DATASET
Private Sub MovePrevious()
Me.bmgrid.Position -= 1
End Sub
'EVENT THAT TRIGGERS MOVE FORWARD
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
Me.MoveNext()
End Sub
'EVENT THAT TRIGGERS MOVE BACKWARD
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnPrevious.Click
Me.MovePrevious()
End Sub
'DISPLAYs ROWS THAT HAVE BEEN MODIFIED IN A DATAGRID
Private Sub btnSave_issue_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSave_issue.Click
Try
If Me.dsarticlelist.HasChanges Then
Dim myds_u_articles As New DataSet()
myds_u_articles =
Me.dsarticlelist.GetChanges(DataRowState.Modified)
Me.dgdchanges.DataSource = myds_u_articles
'If (ixudata.UpdateArticlesinDB(myds_u_articles)) Then
'Me.dsarticlelist.AcceptChanges()
'Else
' Me.dsarticlelist.RejectChanges()
'End If
End If
Catch
UnhandledExceptionHandler()
End Try
End Sub
text boxes on a form. By merely navigating through the records using a
bindingmanagerbase, the rowstate for each row that I navigate through
changes to modified even though I have not edited the data. What would
cause this? I have included the relevant CODE.
'FORM DATASET DECLARED
Friend dsarticlelist As New DataSet()
Friend issue_id As String
Dim bmgrid As BindingManagerBase
'LOAD THE FORM, FILL DATASET, BIND TO CONTROLS
Private Sub frmArticle_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
loadarticles(Me.issue_id)
Me.BindArticleDataSettofields()
bmgrid = BindingContext(Me.dsarticlelist, "ixu_articles")
'Me.loadauthorsubjects(txtArticle_id.Text)
End Sub
Private Sub loadarticles(ByVal i_id As String)
dsarticlelist = ixudata.GetArticles(i_id)
End Sub
'SET ISSUE_ID THAT IS USED TO GET ARTICLES
Public Sub SetIssue_ID(ByVal i_id As String)
Me.issue_id = i_id
End Sub
'BIND DATASET TO CONTROLS
Private Sub BindArticleDataSettofields()
Me.txtTitle.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.title"))
Me.txtSummary.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.summary"))
Me.txtDoc_Type.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.doc_type"))
Me.txtPage.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.page"))
Me.txturl.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.url"))
Me.txtIssue_id.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.issue_id"))
Me.txtArticle_id.DataBindings.Add(New Binding("text", _
Me.dsarticlelist, "ixu_articles.article_id"))
End Sub
'MOVE FORWARD THROUGH DATASET
Private Sub MoveNext()
Me.bmgrid.Position += 1
End Sub
'MOVE BACKWARD THROUGH DATASET
Private Sub MovePrevious()
Me.bmgrid.Position -= 1
End Sub
'EVENT THAT TRIGGERS MOVE FORWARD
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
Me.MoveNext()
End Sub
'EVENT THAT TRIGGERS MOVE BACKWARD
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnPrevious.Click
Me.MovePrevious()
End Sub
'DISPLAYs ROWS THAT HAVE BEEN MODIFIED IN A DATAGRID
Private Sub btnSave_issue_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSave_issue.Click
Try
If Me.dsarticlelist.HasChanges Then
Dim myds_u_articles As New DataSet()
myds_u_articles =
Me.dsarticlelist.GetChanges(DataRowState.Modified)
Me.dgdchanges.DataSource = myds_u_articles
'If (ixudata.UpdateArticlesinDB(myds_u_articles)) Then
'Me.dsarticlelist.AcceptChanges()
'Else
' Me.dsarticlelist.RejectChanges()
'End If
End If
Catch
UnhandledExceptionHandler()
End Try
End Sub