salve ragazzi ho un grandissimo problema e spero qualkuno di voi mi possa dare una mano:
io ho una cartella con dei file immagine numerati così 1.jpg,2.jpg etc e fin qua nulla di strano
il problema viene quando devo leggere i file con il for each perchè il file 10.jpg me lo mette dopo il file 1.jpg come fare io ho fatto così per ordinarli ma mi da errore:
codice:
Dim di As New IO.DirectoryInfo(Server.MapPath("immaginefinale"))
Dim diar1 As IO.FileInfo() = di.GetFiles("*.jpg")
Array.Sort(diar1)
For Each dra In diar1
response.write (Path.GetFileNameWithoutExtension((Server.MapPath ("immaginefinale/" & dra.Name.ToString))))
next
errore
At
codice:
least one object must implement IComparable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: At least one object must implement IComparable.
Source Error:
Line 15: Dim di As New IO.DirectoryInfo(Server.MapPath("immaginefinale"))
Line 16: Dim diar1 As IO.FileInfo() = di.GetFiles("*.jpg")
Line 17: Array.Sort(diar1)
Line 18: 'Dim max As Integer = diar1.GetLowerBound(0)
Line 19: 'Dim g As String = diar1.GetValue(diar1.GetUpperBound(0)).ToString
grazie a tutti anticipatamente