Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1006653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:29:41+00:00 2026-05-16T08:29:41+00:00

Having problem understanding Delegate error. Error says expression expected, How do I fix? Thanks

  • 0

Having problem understanding Delegate error. Error says expression expected, How do I fix? Thanks for any help.

Here is the offending line (#259)….

mylist.ForEach(Delegate Function(P As linkItem) As System.Char[] )

Here is the entire code.

<script language="VB" runat="server">  

    Function sectionTitle(ByRef f As String)

        'Open a file for reading
        'Dim FILENAME As String = Server.MapPath("index.asp")
        Dim FILENAME As String = f

        'Get a StreamReader class that can be used to read the file
        Dim objStreamReader As StreamReader
        objStreamReader = File.OpenText(FILENAME)

        'Now, read the entire file into a string
        Dim contents As String = objStreamReader.ReadToEnd()

        'search string for <title>some words</title>     
        Dim resultText As Match = Regex.Match(contents, "(<title>(?<t>.*?)</title>)")
        'put result into new string
        Dim HtmlTitle As String = resultText.Groups("t").Value

        Return HtmlTitle

        ' If HtmlTitle <> "" Then
        'Response.Write(HtmlTitle)

        ' Else
        'Response.Write("<ul><li>b: " & contents & "</a></li></ul>")

       ' End If

    End Function


    Public Class linkItem

        Public myName As String
        Public myValue As String

        Public Sub New(ByVal myName As String, ByVal myValue As String)


            Me.myName = myName

            Me.myValue = myValue


        End Sub 'New 

    End Class 'linkItem



    Sub DirSearch(ByVal sDir As String)

        Dim d As String
        Dim f As String
        Dim mylist As New List(Of linkItem)


        Try
            For Each d In Directory.GetDirectories(sDir)
                'Response.Write("test c")

                For Each f In Directory.GetFiles("" & d & "", "index.asp")

                    'Response.Write("test a")                   
                    Dim sTitle As String = sectionTitle(f)
                    'remove wilbur wright college - from sTitle string
                    sTitle = Regex.Replace(sTitle, "My College - ", "")
                    'print section title - must come before search n replace string
                    f = Regex.Replace(f, "C:\\inetpub\\wwwroot\\pathtosite\\", "")
                    'add to list
                    mylist.Add(New linkItem(f, sTitle))
                    'print links as list
                    'Response.Write("<ul><li><a href='" & f & "'>" & sTitle & "</a></li></ul>")
                    mylist.ForEach(Delegate Function(P As linkItem) As System.Char[] ) 
                    If (True) Then
                        Response.Write("<ul><li><a href='" & P.myValue & "'>" & P.myName & "</a></li></ul>")
                    End If


                Next
                DirSearch(d)
            Next
        Catch excpt As System.Exception
            'Response.Write("test b")
            Response.Write(excpt.Message)
        End Try
    End Sub




</script>
<%     
    'Dim sDir As New DirectoryInfo(Server.MapPath(""))

    Call DirSearch((Server.MapPath("")))
%>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:29:42+00:00Added an answer on May 16, 2026 at 8:29 am

    It depends on what you are trying to do. You are missing the function body. But you probably need to change that line to something like this:

    mylist.ForEach(AddressOf ProcessLink)
    

    Then you need to create a sub, like so:

    Sub ProcessLink(li As linkItem)
        ' Do stuff here
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 497k
  • Answers 497k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In terms of Enterprise Library, the best case scenario would… May 16, 2026 at 11:56 am
  • Editorial Team
    Editorial Team added an answer I don't know what version(s) would be ok for you… May 16, 2026 at 11:56 am
  • Editorial Team
    Editorial Team added an answer No, the compiler has it right. :) The parameter l… May 16, 2026 at 11:56 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am having problem uplaoding file, here are my codes: Any help? Thanks! test.html
I'm having a problem understanding the shift/reduce confict for a grammar that I know
I'm having a problem understanding Java generics and I've simplified to this example class
I'm having problem with understanding some of QList behavior. #include <QList> #include <iostream> using
I am having a problem understanding how array.sort{ |x,y| block } works exactly, hence
I'm having a problem understanding something about MVVM. My application relies on dialogs for
I am having a problem understanding how these functions update the underlying ref, atom
I am having a problem understanding which function runs (probably in infinite loop) in
I am having a problem understanding how polymorphism works when using generics. As an
Iam having problem creating postgresql function in plperl CREATE OR REPLACE FUNCTION zm_json (TEXT,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.