troubleshooting Question

adding a message to first and last record methods

Avatar of brillox
brilloxFlag for United Kingdom of Great Britain and Northern Ireland asked on
Visual Basic.NET
9 Comments1 Solution251 ViewsLast Modified:
Bsically I would like to add a message when the first and last records hits their limits

eg if the user keep pressing on previous record button, but he/she is already at the first record, I would like to display a message saying ... bla bla you are already there.. I tried this but... it does not work

Private Sub ButtonPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPrevious.Click
        'go to previous record
        If (Me.BindingContext(dsClients, "clients").Position < 0) Then
            MsgBox("Sorry, no more records", MsgBoxStyle.Exclamation)
            Me.BindingContext(dsClients, "Clients").Position = _
                           Me.BindingContext(dsClients, "Clients").Position - 1
        End If

        'update label records
        LabelShowRec.Text = "YOU ARE IN RECORD  " & (((Me.BindingContext(dsClients, "Clients").Position _
        + 1).ToString + "  OF   ") & Me.BindingContext(dsClients, _
    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros