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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:34:33+00:00 2026-05-11T00:34:33+00:00

I’m having some problems with a datagridview element I’m using in VS2008. This DataGridView

  • 0

I’m having some problems with a datagridview element I’m using in VS2008. This DataGridView is actually a tab in a TabControl element.

I gave it 5 colums which need to be filled up with elements from a costum Object i made.

It’s basically a small library application which contains a main class and several classed derived from it. They all have a ToString() method which represents the data as a string of keywords containing the values needed for me to fill up the datagridview.

I only need the first 5 though, some objects will have up to 12 keywords. Currently, Whenever I add an object, the datagrid doesn’t fill itself, instead it adds an amount of columns equall to the amount of keywords the specific object has.

What i’m currently doing is this:

public void libDataGrid_Click(object sender, EventArgs e)         {             if(this.manager.Lib.LibList[0] != null)             {                 libDataGrid.DataSource = this.manager.Lib.LibList;                 libDataGrid.Refresh();             }         } 

this.manager.Lib.LibList returns and ArrayList, in which all objects are stored. The ArrayList can contain elements of all derived classes, but since they are all connected, the string representation will always contain the elements I need to fill up the grid.

I don’t see how I can filter only the first five and them have them put in the correct colums.

And another thing. Currently I can only refresh the DataGridView by clicking it. It should change on when I switch to it switch to its specific tab on the Tabcontrol I mean.

I tried adding an argument for SelectedIndexChanged, but that does nothing really… Or at least, it doesn’t appear to do anything.

What I mean is I commented out the code above and added this instead:

public void tabControl1_SelectedIndexChanged(object sender, EventArgs e)         {                 libDataGrid.DataSource = this.manager.Lib.LibList;                 libDataGrid.Refresh();         } 

This refreshes it everytime the tab is changed, no matter to which one. I had to remove the if-statement, since it gave me an Exception. Probably because the length of the ArrayList isn’t set on initialisation.

  • 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. 2026-05-11T00:34:34+00:00Added an answer on May 11, 2026 at 12:34 am

    I’m a little confused by the question, but here are some thoughts:

    1. DataGridView has an AutoGenerateColumns property; if you don’t want it to create its own columns, set this to false
    2. To bind to existing columns, the DataPropertyName must be set on each
    3. DataGridView (in cmomon with any list control using TypeDescriptor) will hugely prefer List<T> (for some T != object) to ArrayList, since it can get meta-data even for an empty list. In general, in 2.0 using ArrayList is a mistake.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You should call document.getElementById after the document is loaded. Try… May 11, 2026 at 11:37 pm
  • Editorial Team
    Editorial Team added an answer As others have said, don't restrict the set of characters… May 11, 2026 at 11:37 pm
  • Editorial Team
    Editorial Team added an answer Yes, it's called a set. Most languages implement them in… May 11, 2026 at 11:37 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.