473,800 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binding a BindingList to a DataGridView

I'm a newbie to c#, so bear with me.
I'm trying to get data into from a DataReader, put it into a
BindingList that is bound into a DataGridView. My code is:

BindingList<str ing[]bl = new BindingList<str ing[]>();
BindingSource bs = new BindingSource() ;
DataGridView dgv = new DataGridView();

load_list()// method that loads the list using the DataReader

bs.DataSource = bl
dgv.DataSource = bs
As I debug, I can see that the values in bl are correct (columns are
"start", "end", "duration") , but the DataGridView shows the following
columns: Length, LongLength, Rank, SyncRoot, IsReadOnly, IsFixedSize,
IsSynchronized. Of course all rows have the same value for each of
the columns.

What am I doing wrong?

Let me know if more code is needed.
Thanks in advance

Nov 20 '08 #1
0 2627

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1293
by: guy | last post by:
i have a datagridview and i am attempting to bind a bindingList to it. if autoGenerate columns is true the grid corectly displays all columns in the list. if AutoGenerateColumns is false i still get all the rows however the data is not displayed. the columns are generated and appear to be correct - the ColumnName maps onto the property name of the collection. should i be doing something else?
1
3110
by: Pieter | last post by:
Hi, I have a custom List that inherits from BindingList. It has some methods overloaded, like the Add/Insert/etc to add and remove some eventhandlers when adding or removing an item T of the list. The problem happens when: - I use such a BindingList as DataSource for a BindingSource. - Add this BindingSource as DataSource for a DataGridView. - And go to the NewRow and add a new row in the DataGridView.
4
5894
by: Stuart | last post by:
I hope someone can shed some light on an error I've been experiencing for sometime now, but can no longer continue to ignore :-( I've created a custom entity class which implements IEditableObject. I have then created a custom collection for this custom entity which naturally inherits CollectionBase and implements IBindingList. When I bind my custom collection to a DataGridView and started editing, it works correctly only up to the...
2
24523
by: Jeff | last post by:
..NET 2.0 VS2005 I'm wondering if it possible to bind an IEnumerable list directly to a DataGridView? if it is possible then I'm wondering how it should be done? I ask because I think it must be better to use that, than the implementing a foreach loop adding a row to the DataGridView for every element in the IEnumerable list...
4
1530
by: jehugaleahsa | last post by:
Hello: We are working on a large number of forms. The original approach was to use the built-in data designer, type-specific DataTables and form binding. However, we are running into various issues due to the complexity of our forms. For instance, how do you bind to a check box with a data table, or a radio group? Well, I have since started making business objects that wrap around DataRows. The business objects simply provide...
11
76286
by: dave18 | last post by:
Hello all! I found a solution to my original question, but there's still so much I don't understand about it, I thought I'd give this forum a try. At the very least, maybe it will help someone else who got stumped like I did. It seems so simple... binding a DataGridView to a List<T>. These are the two general problems that I kept running into: (1) When the data in the list updated, the data on the screen did not update. (2) When I...
1
2117
by: Jim Balo | last post by:
Hi, When I bind a BindingList<to a DataGridView and then call RemoveAt(n) on it, I get ArgumentOutOfRange. Could someone explain why? Sample: public partial class TestForm2 : Form { private BindingList<Person_personList = new BindingList<Person>();
0
2804
by: =?Utf-8?B?Q2xhdWRl?= | last post by:
It is possible to capture the "AddingNew" event to create our own object before it is append to the BindingList (using e.NewObject = new ...) When the user press delete on a row to remove a row from the DataGridView, I need to do some stuff before it actualy modify the content of the BindingList. Is it possible ? I tried to capture "List_Changed" event, but it's too late, the object is already gone from the bindinglist ! What can I do ?
4
2979
by: csharpula csharp | last post by:
Hello, I would like to know how can I copy from BindingList<objto some other BindingList<obj>? I tried to pass one binding list to other via constractor but this is copying it by reference and I want by value. How can I do it? Thank u very much!
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.