Link to home
Start Free TrialLog in
Avatar of mathieu_cupryk
mathieu_cuprykFlag for Canada

asked on

Record count not being incremented,

Public Sub DoAddnew()
        Dim bm As BindingManagerBase = Me.DataGrid1.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember)
        Dim dr As DataRow = CType(bm.Current, DataRowView).Row
        Dim addform As New AddTransOverride(dr)
        Dim retval As DialogResult = addform.ShowDialog()
        If retval = DialogResult.OK Then
            bm.EndCurrentEdit()
            Try
                Dim substr As String = dr.Item(4)
                If substr Is System.DBNull.Value Then
                    substr = ""
                End If
                If Not substr = "" Then
                    substr = substr.Substring(0, 2)
                End If
                ExecOnTransOverride.ins(dr.Item(1), dr.Item(2), dr.Item(3), substr, dr.Item(5), dr.Item(6), dr.Item(8), dr.Item(7), DateTime.Now, dr.Item(7), dr.Item(9))
                MsgBox("Data Inserted Successfully !", MsgBoxStyle.Information, Me.Text)
                Me.lbNumRec.Text = dv.Count.ToString()
            Catch se As SqlException
                MessageBox.Show(se.Message)
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        Else
            bm.CancelCurrentEdit()
        End If

    End Sub
This is not incrementing the count label Me.lbNumRec.Text = dv.Count.ToString()
ASKER CERTIFIED SOLUTION
Avatar of ElrondCT
ElrondCT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mathieu_cupryk

ASKER

My fault ElrondCT. I did not see it.

Thanks.
Sometimes a second set of eyes is all you need. We've all been there.