D
DesCF
Below is a section from my aspx web page. If I create the same but place
the function GetPhotos() in a separate vb file I get the following errors
underlined in blue:
List(Of String) - Type 'List' is not defined
Directory - Name 'Directory' is not declared
Path - Name 'Path' is not declared
Does anyone know why this is? Have I missed something obvious?
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Collections.Generic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
Public Function GetPhotos() As List(Of String)
Dim photos As New List(Of String)()
Dim photoPath As String = MapPath("~/Photos")
Dim files As String() = Directory.GetFiles(photoPath)
For Each photo As String In files
photos.Add("~/Photos/" + Path.GetFileName(photo))
Next
Return photos
End Function
the function GetPhotos() in a separate vb file I get the following errors
underlined in blue:
List(Of String) - Type 'List' is not defined
Directory - Name 'Directory' is not declared
Path - Name 'Path' is not declared
Does anyone know why this is? Have I missed something obvious?
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Collections.Generic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
Public Function GetPhotos() As List(Of String)
Dim photos As New List(Of String)()
Dim photoPath As String = MapPath("~/Photos")
Dim files As String() = Directory.GetFiles(photoPath)
For Each photo As String In files
photos.Add("~/Photos/" + Path.GetFileName(photo))
Next
Return photos
End Function