Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I am currently maintaining a website that was developed using Visual Basic and my problem is that this web application I am currently maintaining or supporting has the following error.

Error 38 'DirList' is not a member of 'TigerBrandsIntranet.Lounge_Image_Library'. C:\Users\Wise\Desktop\Tiger(Intranet)\BackUp of TBIntranet\TBIntranet\Lounge\Image Library.aspx.vb 111 9 TigerBrandsIntranet

This is the code of the page that's giving me problems.

I would appreciate it so much if there's someone who can assist with this error.

XML
Imports System.Drawing
Imports System.IO
Imports System.Drawing.Imaging
Partial Class Lounge_Image_Library
    Inherits System.Web.UI.Page
    Shared amsg As Label = New Label
    Shared qmsg As Label = New Label

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        'Dim strStartPath As String
        If Session("QuicklinksPath") = "" Then
            Session("QuicklinksPath") = Server.MapPath("Image Library\")
        End If
        ListQuicklinks(Session("QuicklinksPath"))
        If Session("ImagePath") = "" Then
            Session("ImagePath") = Server.MapPath("Image Library\")
        End If
        If Request("imgdir") = "" Then
            If Request("back") = "back" Then
                If Session("strStartPath") = Session("ImagePath") Then
                    'do nor remove last dirname as we are at top level
                Else
                    Dim spos, epos
                    epos = Len(Session("strStartPath"))
                    spos = InStrRev(Session("strStartPath"), "\", epos - 1)
                    Session("strStartPath") = Left(Session("strStartPath"), spos)
                End If

            Else
                Session("strStartPath") = Server.MapPath("Image Library\")
            End If
        Else
            If Request("menu") = "QM" Then
                Session("strStartPath") = Session("ImagePath") & Request("imgdir") & "\"
            Else
                Session("strStartPath") = Session("strStartPath") & Request("imgdir") & "\"
            End If

        End If
        ListFolder(Session("strStartPath"))
    End Sub
    Private Sub ListFolder(sFolderPath As String)
        Dim DirNames, ilink As String
        Dim cp
        cp = 1
        'start table
        amsg.Font.Name = "Arial"
        amsg.Font.Size = amsg.Font.Size.Small
        amsg.Text = "<table width=100% cellspacing=4 cellpadding=4 >"


        DirNames = Dir(sFolderPath, vbDirectory)
        If Session("strStartPath") = Session("ImagePath") Then
        Else
            ' write back
            amsg.Text += "<tr><td colspan=2 >"
            amsg.Text += "<a href=""Image Library.aspx?hdir=../&back=back"" style=""color:#000333;font-size:12px;text-decoration:none;""><<<<<< Back</a><br></td></tr>"
        End If

        Do While DirNames <> ""
            If DirNames <> "." And DirNames <> ".." Then
                If (GetAttr(sFolderPath & DirNames) And vbDirectory) = vbDirectory Then
                    'Session("strStartPath") = sFolderPath & DirNames
                    If cp = 1 Then
                        'begin new rol
                        amsg.Text += "<tr>"
                        'cp = cp + 1
                    End If
                    amsg.Text += "<td><a href=""Image Library.aspx?hdir=../&imgdir=" & DirNames & """ style=""color:#000333;font-size:12px;text-decoration:none;"">" & DirNames & "</a></td>" 'Print dir Folder Name
                    cp = cp + 1
                Else
                    Dim image As System.Drawing.Image = System.Drawing.Image.FromFile(sFolderPath & DirNames)
                    Dim X As Integer = image.Width
                    Dim y As Integer = image.Height
                    Dim height As Integer = ((100 * y) / X)

                    Dim base64String As String
                    Using thumbnail As System.Drawing.Image = image.GetThumbnailImage(100, height, New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback), IntPtr.Zero)
                        Using memoryStream As New MemoryStream()
                            thumbnail.Save(memoryStream, ImageFormat.Png)
                            Dim bytes As [Byte]() = New [Byte](memoryStream.Length - 1) {}
                            memoryStream.Position = 0
                            memoryStream.Read(bytes, 0, CInt(bytes.Length))
                            base64String = Convert.ToBase64String(bytes, 0, bytes.Length)
                        End Using

                    End Using
                    ilink = sFolderPath & DirNames
                    ilink = Replace(ilink, Server.MapPath("Image Library\"), "")
                    ilink = Replace(ilink, "\", "/")
                    If cp = 1 Then
                        'begin new rol
                        amsg.Text += "<tr>"
                        'cp = cp + 1
                    End If
                    amsg.Text += "<td><a href=""Image Library/" & ilink & """ target=_blank style=""color:#000333;font-size:12px;text-decoration:none;""><img border=0 align=middle src=""data:image/png;base64," & base64String & """>&nbsp;&nbsp;" & DirNames & "</a></td>"
                    cp = cp + 1
                End If
                If cp = 3 Then
                    'close ro
                    amsg.Text += "</tr>"
                    cp = 1
                End If
            End If
            DirNames = Dir()
        Loop
        'close table
        amsg.Text += "</table>"


        Me.DirList.Controls.Add(amsg)

    End Sub
    Private Sub ListQuicklinks(sFolderPath As String)
        Dim DirNames As String

        qmsg.Font.Name = "Arial"
        qmsg.Font.Size = amsg.Font.Size.Small
        qmsg.Text = ""


        DirNames = Dir(sFolderPath, vbDirectory)


        Do While DirNames <> ""
            If DirNames <> "." And DirNames <> ".." Then
                If (GetAttr(sFolderPath & DirNames) And vbDirectory) = vbDirectory Then
                    qmsg.Text += "<tr>"
                    qmsg.Text += "<td class=""style70"">&nbsp;</td>"
                    qmsg.Text += "<td style=""background-image: url('../../Images/Dots_Underline.gif'); background-repeat: repeat-x; background-position: center bottom; padding-left:5px; class=""style64"">"
                    qmsg.Text += "<a  title=""Go to the " & DirNames & " Page"" class=""Text"" href=""Image Library.aspx?hdir=../&menu=QM&imgdir=" & DirNames & """ target=""_self"" style=""color:#666666;font-size:11px;text-decoration:none;"">" & DirNames & "</a></td>"
                    qmsg.Text += "<td style=""background-image: url('../../Images/Dots_Underline.gif'); background-repeat: repeat-x; background-position: center bottom; padding-left:5px; "" >&gt;</td>"
                    qmsg.Text += "<td >&nbsp;</td>"
                    qmsg.Text += "<td rowspan=""3"">&nbsp;</td>"
                    qmsg.Text += "</tr>"
                Else

                End If

            End If
            DirNames = Dir()
        Loop

        Me.QMenu.Controls.Add(qmsg)

    End Sub
    Public Shared Function GetFilesRecursive(ByVal initial As String) As List(Of String)
        ' This list stores the results.
        Dim result As New List(Of String)
        ' This stack stores the directories to process.
        Dim stack As New Stack(Of String)

        ' Add the initial directory
        stack.Push(initial)

        ' Continue processing for each stacked directory
        Do While (stack.Count > 0)
            ' Get top directory string
            Dim dir As String = stack.Pop
            amsg.Text += "<a href=""Image Library.aspx?hdir=../&imgdir=" & dir & """ style=""text-decoration:none;"">" & dir & "</a><br>"
            Try
                ' Add all immediate file paths
                result.AddRange(Directory.GetFiles(dir, "*.*"))
                ' Loop through all subdirectories and add them to the stack.
                Dim directoryName As String
                For Each directoryName In Directory.GetDirectories(dir)

                    stack.Push(directoryName)
                Next
            Catch ex As Exception
            End Try
        Loop

        ' Return the list
        Return result
    End Function
    Public Function ThumbnailCallback() As Boolean
        Return False
    End Function
End Class
Posted
Comments
Krunal Rohit 17-Mar-14 10:20am    
Where the error is ??

-KR

The error message is quite obvious. If you cannot read and understand it, nothing can else help you. This is you who wrote this DirList, no one else. Moreover the mere fact that this non-existent member comes after this. tells us that you wrote it in your own class called Lounge_Image_Library. So, that way you who created some class, tried to use some non-existing member named DirList, which you did not bother to create in your own class.

So, it looks like the whole post makes no purpose. The problem is clear and apparent, so it's hard to imagine that you would need any help understanding it. As to the "fixing", this task is not possible or impossible, it is simply undefined, because no one except you knows your intent. Worse if you don't know it, too.

—SA
 
Share this answer
 
It is in the line
Me.DirList.Controls.Add(amsg)
isn't it?
This means that the class Lounge_Image_Library does not contain a member with the name DirList.
I do not know what type it is expected to be, at least it must have a Controls collection.
Since the code snippet states
Partial Class
I'd suspect that it could be declared in another code file, which is missing in your project.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900