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()
mathieu_cuprykAsked:
Who is Participating?
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.

ElrondCTCommented:
I don't see anywhere that you either Dim or access "dv", which presumably is intended to be a DataView. I would suppose it has to be defined somewhere, or Intellisense would give you an error on the dv.Count.ToString call. But it may not be connected to your other data elements, in which case you're certainly not going to get the Count incrementing.

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
mathieu_cuprykAuthor Commented:
My fault ElrondCT. I did not see it.

Thanks.
ElrondCTCommented:
Sometimes a second set of eyes is all you need. We've all been there.
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
Visual Basic.NET

From novice to tech pro — start learning today.