Path.GetExtension Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grey15
    New Member
    • Sep 2007
    • 10

    Path.GetExtension Error

    Dim temp As String
    Dim index As Integer
    Dim arList As ArrayList
    temp = "images/"
    For index = 0 To temp.Length - 1
    If path.GetExtensi on(temp(index)) = ".jpg" Then

    arList.Add(temp (index))
    End If

    Next
    I am trying this code, but its giving me error that 'GetExtension is not a member of String'.

    Can you help plz?
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    try using the full namespace
    System.IO.Path. GetExtension(yo urFileStringGoe sHere);

    However, the GetExtension Method requires a string to be passed,
    By sending temp(index) you are sending it a character.

    it should look somewhat like this

    System.IO.Path. GetExtension("C :\Images\MyImag e.jpg")

    Comment

    Working...