Errors

S

Sheldon Glickler

I am getting error messages that I do not understand:
1. Unused local variable 'filePath'
2. Access of shared member, constant member, enum member or nested type
through an instance; qualifying expression will not be evaluated. (this
was at the "files =" line)


What is happening?

Shelly

Here is the code:
Function CreateDataSource() As ICollection
Dim dt As DataTable
Dim dr As DataRow
Dim filePath As Directory
Dim directory As String
Dim files As String()
Dim File As String

directory = "C:\apcourier\aspx\photos\1012"
files = filePath.GetFiles(directory, "*")

'create a DataTable
dt = New DataTable
dt.Columns.Add(New DataColumn("TheFile", GetType(String)))

'Put data in the rows
For Each File In files
dr = dt.NewRow()
dr(0) = "C:\apcourier\aspx\photos\1012\" & File
dt.Rows.Add(dr)
Next

'return a DataView to the DataTable
CreateDataSource = New DataView(dt)

End Function
 
S

Shelly

I fixed this by getting rid of the Dim filePath and changing the "files ="
to
files = System.IO.Directory.GetFiles(directory, "*")

I don't know why this error occured because previously I had an Imports of
System.IO and System.Data (in both the aspx file and in the code-behind vb
file.

Shelly
 
S

Shelly

Nick Chan said:
those are not errors
only warnings

I disagree. When it says "qualifying expression will not be evaluated" it
means that it doesn't get any values. Hence my directory search comes up
with nothing and so nothing displays. Those are errors.

Shelly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top