Hi Alls,

Really need your help.
I'm trying to list all text file in Application Startup path folder in combobox but cannot...can anyone help?.....In Application Startup Path folder i got more than 3 .txt file. So i want to list out in combobox...please help me..thank you

here try this:

Imports System.IO
Imports System.IO.Path
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim strPath As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\"

        Dim dirInfo As New IO.DirectoryInfo(strPath)

        For Each file As FileInfo In dirInfo.GetFiles("*.txt", SearchOption.TopDirectoryOnly)
            ComboBox1.Items.Add(file.Name)
        Next

    End Sub
End Class

This might help also. Just change the ListBox to a ComboBox.

Dim myCoolFolder As String = "C:\!vbTemp\" '// your folder.

        For Each myCoolFile As String In My.Computer.FileSystem.GetFiles _
                                                    (myCoolFolder, FileIO.SearchOption.SearchTopLevelOnly, "*.*")
            ListBox1.Items.Add(IO.Path.GetFileName(myCoolFile)) '// add file name with extension.
        Next

        '// to search subfolders, change "SearchTopLevelOnly" to "SearchAllSubDirectories".
        '// to only get a certain file type, change "*.*" to your file type.
        '//-- example for .txt files: "*.txt"

tq all...ur are awesome.....

Since you cannot receive private messages, I'll post here and remind you to not forget to mark the thread solved if Solved. And of course, glad I could help. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.