473,545 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Errors appear in vb file only

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="Syst em.IO" %>
<%@ Import Namespace="Syst em.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.GetFi les(photoPath)
For Each photo As String In files
photos.Add("~/Photos/" + Path.GetFileNam e(photo))
Next
Return photos
End Function

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Dec 17 '06 #1
1 1125
Ok, I've sorted it out. I needed to put the following 2 lines at the top
of the vb file:

Imports System.IO
Imports System.Collecti ons.Generic


On Sun, 17 Dec 2006 11:17:25 -0000, DesCF <de***@aol.comw rote:
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="Syst em.IO" %>
<%@ Import Namespace="Syst em.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.GetFi les(photoPath)
For Each photo As String In files
photos.Add("~/Photos/" + Path.GetFileNam e(photo))
Next
Return photos
End Function


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Dec 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7386
by: Michelle Kinsey-Clinton | last post by:
Hello, I am writing an ASP app which is giving me some very frustrating errors. They appear intermittently, no real pattern to them, and often go away if you reload, or back up a few pages and start over again. The first error is logged as a 400 error and says only, "The parameter is incorrect." It (mostly, but not always) happens upon...
4
6399
by: Morgan Leppink | last post by:
Hey all - We are running SQL 2000 with ALL available service packs, etc. applied. We just built a brand new database server, which has dual 2Ghz XEONs, 2GB memory, and the following disk configuration: RAID 1 array (2 disks) Operating System Windows Server 2003 RAID 1 array (2 disks) Database Logs RAID 10 array (4 disks) ...
6
3234
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start erroring out. I see two different errors. One is a "Object reference not set to an instance of an object." error, which appears to always contain the...
19
1463
by: mailbox | last post by:
In trying to build the Perl Curses module (Curses-1.12) under Perl 5.8 on a new AIX box I came up against the limits of my C as well as my Unix knowledge. The thing had built okay under Perl 5.6 on the old AIX system. The only co-worker within reach who seems to know more C than I do had no clue either. I have put the error messages and...
24
2477
by: Massimo Soricetti | last post by:
Hello, I'm not a C newbie, but I'm teaching C programming (well... FIRST programming and then C) to other guys these days and it's driving me to some reflexions on the language. It's not uncommon to forget a } writing code, and at compiling time get an error 18956778 lines after the mistake, in an otherwise absolutely correct piece of...
3
3816
by: Simon | last post by:
This problem has been driving me mad for months.... Seen a few posts on forums about it but no answers... No mention on MSDN etc. XP Pro SP1, VS.NET (c#) .Net framework 1.1, IIS 5.1. In a nutshell when testing my ASP.NET (localhost) apps images randomly don't load on the page. Examining the IIS logfile shows the missing images give 401 or...
11
1390
by: Roger Vale | last post by:
Hi all Visual studio 2005 Visual Basic windows mobile application I am getting this from the imediate window A first chance exception of type 'System.InvalidCastException' occurred in System.Drawing.dll Now the program still runs but this error seems to appear every time i swap
0
1473
by: Gregory Gadow | last post by:
We have a number of development machines in our IT department, all running the same version of VS 2005 sp 1. Our company website and several compiled components were all written in VB.Net 2.0 using one of those machines, our "main dev." When I pull up the website in the VS IDE on that one machine, everything is fine. On any of the other...
1
3150
by: =?Utf-8?B?Q3VzdG9t?= | last post by:
I tried to update Vista OS to Vista SP1, when system restarts during installation it checks disk volume for errors, in the process of scaning disk if finds some errors as follows: Checking file system on C: The type of the file system is NTFS. Volume label is C-Win Vista. Windows will now check the disk. 232832 file records processed. 766...
0
7475
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7771
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3465
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1900
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
720
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.