troubleshooting Question

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

Avatar of maqskywalker
maqskywalker asked on
ASP.NETVisual Basic.NET
2 Comments1 Solution381 ViewsLast Modified:
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



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?
ASKER CERTIFIED SOLUTION
Paul Jackson
Software Engineer
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros