Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is it possible to have a BindingSource with DataGridView when each column shows one object in a list?

Posted on 2009-07-09
2
Medium Priority
?
356 Views
Last Modified: 2013-11-15
I'm building a windows forms application in C# using Visual Studio 2008, LINQ to SQL, .NET Framework 3.5
I'm trying to find an easy way to bind a list of Business Objects to a DataGridView where each column represent an instance of my class and each row shows one property value of that object. The user can modify the properties values using the datagridview cells.
(This is essentially a transposed table)

Here is an example of the table:
            Model Set 1      Model Set 2      Model Set 3
Model Set Name                        
Calculate            TRUE      TRUE      TRUE
Default Rate            Or Vector      Or Vector      Or Vector
Default Units                        
Prepay Rate            Or Vector      Or Vector      Or Vector
Prepay Units                        
Severity Rate            5            6             7
Severity Rate                        
MappingRule01                         

What is the easiest way to accomplish this task? I thought about using a DataTable instead of a BindingList, but I'm not sure if that's easier because I'll have to code all the logic to populate the ModelSet objects, Remove and Add etc. I think it will be easier to accomplish using a BindingList but I might be wrong.



// This is my class to be displayed in each column
public class ModelSet 
{
        public int ID { get; set; } 
        public string ModelSetName { get; set; } 
        public string DealName { get; set; } 
        public string TrancheName { get; set; } 
        public bool Calculate { get; set; } 
        public string LossVector { get; set; } 
        public string PrepayVector { get; set; } 
        public string SeverityVector { get; set; } 
        public string RuleSet01	{ get; set; }
}

Open in new window

0
Comment
Question by:JoshKatz78
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Assisted Solution

by:graye
graye earned 80 total points
ID: 24840989
No, the BindingList is precisely the correct tool in this case...
By default it will expose all public properties.... so to hide a property you can exclude it from the DataGridView (or convert the property to the method..)
0
 

Accepted Solution

by:
JoshKatz78 earned 0 total points
ID: 24841293
I'm using DevExpress vertical grid
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question