Solved

Buttons- Return to beginning and End of a Text File

Posted on 2007-12-03
2
137 Views
Last Modified: 2010-04-30
I have a phone book program that I created in visual basic and I want a button to return to the beginning of all the entries and one button to go to the very last entry. How would I do that?

So far I have this, but I don't think it works properly
Private Sub BtnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFirst.Click
        If Index = Count Then
            Index = Index - Count + 1
            DisplayData()
        End If
    End Sub

    Private Sub BtnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLast.Click
        If Index < Count Then
            Index = Index + Count - 1
            DisplayData()
        End If
    End Sub


Thanks :)
0
Comment
Question by:ashblynn02
2 Comments
 
LVL 4

Assisted Solution

by:origfla
origfla earned 200 total points
Comment Utility
How about:
Index=1

Index=count
0
 
LVL 25

Accepted Solution

by:
imitchie earned 300 total points
Comment Utility
Private Sub BtnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFirst.Click
            Index = 1
            DisplayData()
    End Sub

    Private Sub BtnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLast.Click
        Index = Count
        DisplayData()
    End Sub
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now