Results 1 to 2 of 2

Thread: file scrolling

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Location
    england
    Posts
    87

    file scrolling

    Does anyone know how to retrieve the next file from a directory with a click of a button or something ?

    Lets say i opened a picture from a directory. And i want to view the next picture with just a click of a button instead of opening the file.

    If anyone know any codes who can do this please help me out.



    -----------------------------------------------------------------------------------
    Vb rules

  2. #2
    New Member
    Join Date
    Sep 2001
    Location
    London
    Posts
    8
    Hi
    U can try this code.
    start a Standard EXE project. To the form add 2 buttons and give names "Start" and "Next".
    Add a Text box.
    Paste the following code
    ******************
    Option Explicit
    Dim mbBreak As Boolean
    Dim mbNext As Boolean

    Private Sub Command1_Click()
    On Error GoTo ErrorHandler
    Dim lsRootDir As String
    Dim lsFileName As String

    lsRootDir = "c:\"

    lsFileName = Dir(lsRootDir)
    Text1.Text = lsFileName
    mbNext = False

    Do While lsFileName <> "" And Not mbBreak

    If (mbNext) Then
    lsFileName = Dir()
    Text1.Text = lsFileName
    mbNext = False
    Else
    DoEvents
    End If
    Loop

    Exit Sub
    ErrorHandler:
    MsgBox Err.Description
    End Sub

    Private Sub Command2_Click()
    mbNext = True
    End Sub

    Private Sub Form_Load()
    mbBreak = False
    End Sub

    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    mbBreak = True
    End Sub
    ******************

    It can be done more cleanly using APIs or File Control. Hope it will work for u.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width