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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:29:43+00:00 2026-06-18T11:29:43+00:00

Situation: I am attempting to bind a BindingList<string[]> constructed from a LINQ to SQL

  • 0

Situation:

I am attempting to bind a BindingList<string[]> constructed from a LINQ to SQL query to a DataGridView.

Problem:

I either cannot make modification to the DataGridView after items are generated -or- I get a bunch of unwanted fields in my DataGridView (it depends on which iteration of my code I use) I have googled as hard as I can and tried implementing most of the solutions I have found online to no avail.

I know that string has no public property for its actual value. I am having a difficult time determining how to retrieve that (I believe is part of the problem).

C#

int item = (from p in CurrentConversion.Companies[lbCompanies.SelectedIndex].Modules 
    where p.ModuleName.Equals(clbModules.SelectedItem) 
    select p.ModuleId)
    .FirstOrDefault();

BindingList<string[]> Data = new BindingList<string[]>((
    from p in CurrentConversion.Companies[lbCompanies.SelectedIndex].QuestionAnswers
    where p[2].Equals(item)
    select new string[] { p[0].ToString(), p[3].ToString() })
    .ToList());

dgvQuestions.DataSource = Data;
dgvQuestions.Refresh();

Unwanted Behavior:

This occurs after binding

datagridview

Question:

  1. Why is this happening?
  2. How do I fix it?

Additional Information:

I am not sure what additional information may be need but I will supply what is requested.

Also if I switch to my other code iteration:

int item = (from p in CurrentConversion.Companies[lbCompanies.SelectedIndex].Modules where p.ModuleName.Equals(clbModules.SelectedItem) select p.ModuleId).FirstOrDefault();
            var Data = new BindingList<object>((from p in CurrentConversion.Companies[lbCompanies.SelectedIndex].QuestionAnswers where p[2].Equals(item) select new {Question = p[0].ToString(), Answer = p[3].ToString() }).Cast<object>().ToList());
            dgvQuestions.DataSource = Data;
            dgvQuestions.Refresh();
            dgvQuestions.Columns[1].ReadOnly = false;

I can see the data properly but I cannot edit the column I would like to.

  • 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-18T11:29:44+00:00Added an answer on June 18, 2026 at 11:29 am

    You are binding to a list of string arrays, and you are getting the properties form the array. Most likely you want something like the following:

    var Data = new BindingList<object>((
        from p in CurrentConversion.Companies[lbCompanies.SelectedIndex].QuestionAnswers 
        where p[2].Equals(item) 
        select new {
                    Val1 = p[0].ToString(), 
                    Val2 = p[3].ToString() 
                   }).ToList());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the situation: I’m attempting to build a query with criteria based on
I am attempting to create a data set from an original dataframe (in either
Here's the situation: I'm attempting to get a collection of all types in my
I am attempting to use tortoiseSVN to solve a small problem which I am
I'm creating a a web page scraper. I'm attempting to fill a JTable from
I have a situation in which I am attempting to keep my model and
Situation: I'm porting over, or should I say attempting to port Lakshan Perera's Simple
I have the following situation: I'm currently attempting to write a Metro-style application, with
I have a situation where I am attempting to port some big, complex python
I have the following situation: I need to save data from an Intent's putExtra

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.