How i can get file name?

Johnny5

Member
Joined
Aug 23, 2003
Messages
6
I hava file "C:\\road.dll". I need my program to get its name to the textbox in VB.net. Please help if you can.
Thank you.:)
 
If its called "road.dll" then youd just set the textbox.Text to "road.dll".

You need to be more specific about what you want, if you know the dll name then asking how to get the name seems to be a bit pointless
 
Correctly:

I have a folder with .bmp files. And I need to put all this .bmps(names of bmps) to the LISTBOX...
Help Please.:rolleyes:
 
Something similar to the following should do it.

Code:
dim bmps() as string
bmps = System.Io.Directory.GetFiles(<path to folder>, "*.bmp")
ListBox1.Datasource=bmps
 
This works great, except I cant figure out how to get
rid of the whole programpath?

Everything in the listbox shows as "C:\program files\Test Application\Forms\Reports\filename.xxx
I just want the filename.xxx to show up
 
to get just the file name / extension.
Code:
        Dim strFiles As String() = IO.Directory.GetFiles("C:\", "*.bmp")
        Dim strBmp As String
        For Each strBmp In strFiles
            Dim strName As New IO.FileInfo(strBmp) /// this will return the name only ( eg: mybmp.BMP )
            Console.WriteLine(strName.Name)
        Next
 
Back
Top