I wanted to display all the names of files found in "c:\" in a drop down item
so i wrote
<<<
For Each prgmsfound As String In My.Computer.FileSystem.GetFiles("C:\", FileIO.SearchOption.SearchTopLevelOnly, "*.*")
Prgmstsmi.DropDownItems.Add(prgmsfound)
Next
>>>
So when they appear to me they appear in full directory like "C:\anything.exe", but i don't want this i only want "anything"
What to do
Note: If you can also help me, i want to add the original icon of this
file (e.g:"anything") to its left in the drop down item.

Delete the entire directory without the Name of the file
BillyRay
Not so......
System.Drawing.Icon.ExtractAssociatedIcon(PathAndFilename)
allison_h
supp
i made you a quick function to help you out
that displays the result in the msgbox
the function getfilename needs only the full path & filename
and the optional option is if it should also return the extension of the file name
so if showextension = false then the function only returns the filename "anything" if its set to true then it will return
"anything.exe"
MsgBox GetFileName(str_file_name, False)
Function GetFileName(ByVal Str_Full_File_Name As String, Optional ByVal ShowExtension As Boolean = False) As String
Dim Str_Result As String
Dim Lng_Pos As Long
Str_Result = ""
If Len(Str_Full_File_Name) > 0 Then
Lng_Pos = InStrRev(Str_Full_File_Name, "\")
If Lng_Pos > 0 Then
Str_Result = Mid(Str_Full_File_Name, Lng_Pos + 1)
End If
If ShowExtension = False Then
Lng_Pos = InStr(Str_Result, ".")
If Lng_Pos > 0 Then
Str_Result = Left(Str_Result, Lng_Pos - 1)
End If
End If
End If
GetFileName = Str_Result
End Function
try it out and le me know cools
Dawid Weiss
Dim obj_bmp As Bitmap = fileico.ToBitmap()
dont forget to clean up
killerbambam
and to get the system images you would need to get a handle on the
systemimagelist through that you can get the right icon for your filename or extension
say_2000
Well, i wanted to add this icon to a tooldstripitem so when i write that code
Dim fileico As Drawing.Icon = System.Drawing.Icon.ExtractAssociatedIcon(filename)
thetoolstrip.DropDownItems.Add(filename, fileico)
But this won't work 'cause the add code won't accept it as an icon, but as an image.
What to do
THX anyway