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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:40:30+00:00 2026-06-09T06:40:30+00:00

I have a DataGridView similar to the one below: ID Name Data1 Data2 1

  • 0

I have a DataGridView similar to the one below:

ID    Name    Data1   Data2
1     MM      X       1000
2     ST      Y       1000
3     EC      Z       1000
4     JT      T       1000

I also have a list of row indices that are important to me.

List<int> myList = new List<int>();
myList.Add(1);
myList.Add(2);

Now what I want to do is grab the values from the Data1 column in my DataGridView that corresponds to those row indices. So what I am looking to get out (in this example) is some datatype which contains “Y” and “Z”.

I don’t want to iterate over the DataGridView because I have a large sample of data there. Is there a way to do this with LINQ? I’m still a LINQ beginner.

  • 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-09T06:40:31+00:00Added an answer on June 9, 2026 at 6:40 am

    Use the Enumerable.Select method something like this:

    IEnumerable<string> columnValues = myList.Select(x => data.Rows[x].Cells["Data1"].Value);
    

    This code assumes that a reference to your DataGridView is stored in the variable data.

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

Sidebar

Related Questions

I have a DataSet similar to the one below: ID Name Data1 Data2 1
I have Datagridview .. selected a row .i want that row to be added
If I have a method that returns a datagridview and the flow is similar
I have a List that I want to bind to a DataGridView in a
hi i have datagridview name data1, and binding data to data1 from database, when
I have datagridview with checkbox column, but I want, that some of the columns
I have a datagridview which is editable. I have a textbox below it. I
I have a DataGridView to which I've set a list of objects to the
As a question similar to this question , I also have an application with
My question is similar to below, except that i dont know whats the alternative.

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.