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 264917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:43:32+00:00 2026-05-11T22:43:32+00:00

I am trying to learn some VB.NET for my coo-op that starts next week,

  • 0

I am trying to learn some VB.NET for my coo-op that starts next week, and for that reason i took my portfolio web site that is on C# and just started to converting it to VB.NET to get familiar with the syntax.

I am sure my problem is simple however i have a hard time solving it.
I am trying to grab data with the linq query and then return it as list to bind to the Repeater.

I have the following function:

Public Function getProjects() As List(Of portfolio_website)
        Using myPortfolio As New PortfolioDataContext
            Try

                Dim myProjects = (From p In myPortfolio.portfolio_websites _
                                  Order By p.website_id Descending _
                                  Select New With {.name = p.website_name, .id = p.website_id}).Take(5)

                Return myProjects

            Catch ex As Exception
                Return Nothing
            End Try
        End Using
    End Function

However I am getting an error.

If i would do it in C# then myProjects will be var and in return i will have

return myProjects.ToList();

And it would work fine. However if I try to use ToList() in VB.NET i am getting error that it cannot convert it from ling to sql List to the generic list.

How do i do this convertion in VB.NET ? or maybe there is another way ?

I am decent when it comes to C# however somewhat lost with the VB.NET syntax.

  • 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-11T22:43:32+00:00Added an answer on May 11, 2026 at 10:43 pm

    I hate it.
    Second after I asked my question i realized my mystake.
    It is same as in C#, but if i take

    Select New With {.name = p.website_name, .id = p.website_id
    

    then i either need to have a custom object, or i need to take everything.
    So i changed my linq to sql to the

     Dim myProjects = (From p In myPortfolio.portfolio_websites _
                                  Order By p.website_id Descending _
                                  Select p).Take(5)
    
     Return myProjects.ToList()
    

    and now everything is working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to learn some C#.net. I'm just trying to expose the AdventureWorks database
I am trying to learn some ASP.NET MVC. Please bear with me but asp.net
I am trying to learn some DirectX API and, for now, I have just
I was trying to download some ASP.NET MVC Sample application to learn MVC. I
I am trying to learn how to write more dynamic web sites that use
Just trying to ping up some experienced Thread gurus out there...trying to learn more
I'm an experienced C++/.NET/Java Windows/web programmer trying to learn (Common) Lisp. I'm reading Practical
I'm trying to learn the charting control in asp.net, but I am having some
i am trying to learn ASP.Net MVC2/3 and trying to work on a web
I'm trying to learn some WCF on my own. I have C#/ASP.net knowledge but

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.