?
Solved

Loading 100 rows, reload after you hit the last row

Posted on 2006-05-09
2
Medium Priority
?
232 Views
Last Modified: 2010-04-23
It sounds easy to do, but I have written several things that did not work. I tried to create a function for this and it partially worked. Starting over now, this is all I have.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        OleDbDataAdapter1.Fill(DataSet11, 1, 100, "table")
      End Sub
 
 Private Sub NavPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.BindingContext(DataSet11, "table").Position = (Me.BindingContext(DataSet11, "table").Position - 1)
        Me.PositionChanged()
End Sub

 Private Sub navNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles navNext.Click
        Me.BindingContext(DataSet11, "table").Position = (Me.BindingContext(DataSet11, "table").Position + 1)
        Me.PositionChanged()
End Sub

Public Sub PositionChanged()
        Me.navlocation.Text = (((Me.BindingContext(DataSet11, "table").Position + 1).ToString + " of  ") _
               + Me.BindingContext(DataSet11, "table").Count.ToString)
End Sub
 
   
 
0
Comment
Question by:reefcrazed
2 Comments
 
LVL 34

Accepted Solution

by:
Sancler earned 2000 total points
ID: 16640197
So what code did you try and what was the problem with it?  It looks as though this should work

       If Me.BindingContext(DataSet11, "table").Position = (Me.BindingContext(DataSet11, "table").Count -1) Then 'you're at the end ...

           'so get the next 100 starting from that number
           OleDbDataAdapter1.Fill(DataSet11, Me.BindingContext(DataSet11, "table").Count -1, 100, "table")

       End If

at the start of your Sub navNext_Click should work.  But I haven't tested and I don't know if you've tried it and it doesn't.

Just one point about your present code.  The StartRecord argument in the .Fill method you used is zero-based.  So with

        OleDbDataAdapter1.Fill(DataSet11, 1, 100, "table")

you'll never retrieve the first record.  Is that intentional?

Roger
0
 

Author Comment

by:reefcrazed
ID: 16640641
I think that is good enough for what I need.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question