Full filename from ListBox

Posted on 2004-11-12
Last Modified: 2010-04-23
I have populated a list box of files from a directory.
Now when I select a from from that list box I want a message box to display the full path of the file.
Question by:sherrick123
    LVL 24

    Expert Comment

    by:Jeff Certain
    I'm assuming what you know what directory the files are in. If this is the case, you should be able to do this, assuming you are creating a desktop application:

    msgbox(<directory name> & "\" & listbox1.SelectedItem)

    The \ may or may not be needed, depending on how you're storing your directory name.

    LVL 27

    Accepted Solution

     sample code ....

    Imports System.IO

     Private Sub CheckNameFile()
            ' Create a reference to the current directory.
            Dim di As New DirectoryInfo(listbox1.SelectedItem)
            ' Create an array representing the files in the current directory.
            Dim fi As FileInfo() = di.GetFiles()
            Dim fiTemp As FileInfo
            'Check for old files in directory
            For Each fiTemp In fi
                If fiTemp.Exists Then
                End If
            Next fiTemp
        End Sub

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    733 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

    21 Experts available now in Live!

    Get 1:1 Help Now