Avatar of maqskywalker
maqskywalker
 asked on

Value of type ‘List(Of String); cannot be converted to ‘String()’

I saw these 2 string examples on this link.

https://www.dotnetperls.com/convert-list-string-vbnet

I doing the first one using String.Join

I created a new page called Default.aspx and put a label called Label1 on the page

Then on this page Default.aspx.vb in the page load event I put this code.
Then when I run the page it works fine and the string is displayed on my label.

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' Create list of three strings.
        Dim vals As List(Of String) = New List(Of String)
        vals.Add("dot")
        vals.Add("net")
        vals.Add("perls")

        ' Use string join function that receives IEnumerable.
        Dim value As String = String.Join(",", vals)

        'Show String On Label
        Label1.Text = value

    End Sub

Open in new window




I have a .net 3.5 ASP.NET Web Forms application using VB.

In the page load event of my page I put the same code.

But I get this error message:

error
Any idea of why I'm getting this error message saying Listing(Of String) cannot be converted to String?
ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
maqskywalker

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Paul Jackson

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
maqskywalker

ASKER
Thanks. Good info!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck