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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:32:19+00:00 2026-06-13T03:32:19+00:00

I got a class and i’m try to fill the datgaridview as generic list.

  • 0

I got a class and i’m try to fill the datgaridview as generic list. I got a problem in dapuConfigs.CoveredLaneswhich is a list and i tried to access the list and fill it in the datagridview i coulmdn’t succeed. May be both of approach is wrong here…!
Please help me??

When i run, i’m getting a text appears in the grid cell: system colelction generic list.

Added code :

  .ForEach(
              Configs =>
                  {  
                      { 
                          datagridview1.Rows.Add(
                              new object[]
                                  {
                                      Configs.Id,
                                      Configs.Description,
                                      Configs.Covered.ElementAtOrDefault(0).Id == null ? "" : Configs.Covered.ElementAtOrDefault(0).Id.ToString(),
                                      Configs.Covered.ElementAtOrDefault(1).Id == null ? "" : Configs.Covered.ElementAtOrDefault(1).Id.ToString(),
                                      Configs.Covered.ElementAtOrDefault(2).Id == null ? "" : Configs.Covered.ElementAtOrDefault(2).Id.ToString(),
                                      Configs.Covered.ElementAtOrDefault(3).Id == null ? "" : Configs.Covered.ElementAtOrDefault(3).Id.ToString(),

});
}
});

  • 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-06-13T03:32:20+00:00Added an answer on June 13, 2026 at 3:32 am

    So, where you have

    dapuConfigs.CoveredLanes.ToList(),
    

    in your first example, try changing to:

    dapuConfigs.CoveredLanes.ElementAtOrDefault(0) == null ? "" : dapuConfigs.CoveredLanes.ElementAt(0).ToString(),
    dapuConfigs.CoveredLanes.ElementAtOrDefault(1) == null ? "" : dapuConfigs.CoveredLanes.ElementAt(1).ToString(),
    dapuConfigs.CoveredLanes.ElementAtOrDefault(2) == null ? "" : dapuConfigs.CoveredLanes.ElementAt(2).ToString(),
    dapuConfigs.CoveredLanes.ElementAtOrDefault(3) == null ? "" : dapuConfigs.CoveredLanes.ElementAt(3).ToString(),
    

    Or, for matching on Id

    dapuConfigs.CoveredLanes.First(cl=>cl.Id=="").ToString(),
    dapuConfigs.CoveredLanes.First(cl=>cl.Id=="").ToString(),
    dapuConfigs.CoveredLanes.First(cl=>cl.Id=="").ToString(),
    dapuConfigs.CoveredLanes.First(cl=>cl.Id=="").ToString(),
    

    or more general match on id…

    dapuConfigs.CoveredLanes.First(cl=>cl.Id.Contains("")).ToString(),
    dapuConfigs.CoveredLanes.First(cl=>cl.Id.Contains("")).ToString(),
    dapuConfigs.CoveredLanes.First(cl=>cl.Id.Contains("")).ToString(),
    dapuConfigs.CoveredLanes.First(cl=>cl.Id.Contains("")).ToString(),
    

    andd adding a check for no match…

    dapuConfigs.CoveredLanes.Any(cl=>cl.Id.Contains("")) ? dapuConfigs.CoveredLanes.First (cl=>cl.Id.Contains("")).ToString() : "",
    dapuConfigs.CoveredLanes.Any(cl=>cl.Id.Contains("")) ? dapuConfigs.CoveredLanes.First(cl=>cl.Id.Contains("")).ToString() : "",
    dapuConfigs.CoveredLanes.Any(cl=>cl.Id.Contains("")) ? dapuConfigs.CoveredLanes.First(cl=>cl.Id.Contains("")).ToString() : "",
    dapuConfigs.CoveredLanes.Any(cl=>cl.Id.Contains("")) ? dapuConfigs.CoveredLanes.First(cl=>cl.Id.Contains("")).ToString() : "",
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a class which inherits from a List<MagicBean> . It works well and
I've got a class with many string arrays. I'd like to have one generic
I have got class Car, and each class has list of extras (leather, abs,
I've got class named PagedList which looks like this: public class PagedList<T> : List<T>
Question about subclassing in matlab, under the new class system. I've got class A
I've got a class that looks like: public class Competitor { public virtual int
I've got a class named Hasher in a namespace named Hasher. So the fully-qualified
I've got the class member: LineND::LineND(double a ...) { coefficients.push_back(a); va_list arguments; va_start(arguments, a);
I've got a class where I pass in a panel reference and in that
I've got a class which implements the TableModel Interface. When I call setModel on

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.