473,671 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagrid and custom collection object synchronization

I have custom collection that is bind to the System.Windows. Forms.DataGrid.

My custom collection business object has property Quantity.

public event System.Componen tModel.Property ChangedEventHan dler
QuantityChanged ;
private int quantity;
[System.Componen tModel.Bindable (true)]
public int Quantity
{
get { return quantity; }
set
{
if (quantity != value)
{
quantity = value;
if (QuantityChange d != null)
QuantityChanged (this, new
System.Componen tModel.Property ChangedEventArg s("Quantity") );
}
}
}

Property Quantity is modified through code and datagrid quantity is not
automatically refreshed (QuantityChange d is always null)

Is it possible to somehow accomplish datagrid and collection synchronization
automatically?

I know that I can do something like that, but I want nicer solution (pseudo
code):

MyCollection.Qu antityChanged += new
PropertyChanged EventHandler(re fresh_method);

....

private void refresh_method( )
{
myDataGrid.Refr esh();
}

Thanks in advance
Sanjin
Oct 11 '05 #1
1 1366

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

Similar topics

0
1186
by: Phillip | last post by:
I have a DataGrid bound to a custom collection that implements IBindingList. The collection returns true for AllowNew. The collections AddNew() method creates a new object, adds it to the collection and returns the new object. The SupportsChangeNotification property returns true and the appropriate ListChangedEventArgs are used in the ListChanged event. All fine no problem. However:
2
2743
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx. The problem is the article is in VisualBasic. I already get the collection to be recognized as a Data Source by the IDE. It populated the DataGrid correctly from the fields on the items object of the collection, but I can't get the DataGrid to...
3
4720
by: BobforeApples | last post by:
Hi All, I was trying to apply databinding to a custom collection as in the MSDN Magazine article found in the August, 2005 issue. After converting the code in the article to C# and applying it to an existing set of classes, I tried using the collection as the datasource for a standard DataGrid control. The problem is that the collection contains a collection as one of it's member properties (ie. SampleCollection contains a...
3
2187
by: David | last post by:
Hello, I have a datagrid populated with rows from a view. Because they are from a view, the rows are not actual database records, and therefore lack unique identifiers. So I have a command button for each row. When the button is pressed, I want to go to another page with all the information in that selected row. Normally I would do this (if the rows are actual records, that is)
3
1652
by: Just D | last post by:
Hi, If anybody needs to show some data retrieved from the database table, what method is more preferrable? 1. DataSet ds = ...; DataGrid.Data.Source.ds; DataGrid.Bind(); 2. Write a custom object, fill it with the DataSet data and ÅÒÕÔ try to bind
11
2491
by: Michael Kellogg | last post by:
I have a collection of custom objects that I am displaying in a Windows Forms Datagrid. To display it, I take the collection and build a DataTable object on the fly, then set the grid's DataSource to the DataTable. The code for this is lengthy and the grid is obviously not editable. I've read it's possible to connect my collection directly, and have it be editable, too. Can anyone point me to a resource that can walk me through this? ...
1
285
by: Sanjin | last post by:
I have custom collection that is bind to the System.Windows.Forms.DataGrid. My custom collection business object has property Quantity. public event System.ComponentModel.PropertyChangedEventHandler QuantityChanged; private int quantity; public int Quantity {
1
2701
by: viktor9990 | last post by:
I'm trying to bind a custom collection to an autogenerated datagrid without success. I'm getting this error: DataGrid with id 'DataGrid2' could not automatically generate any columns from the selected data source. Could you help me to find a solution? What is the problem in my code? Thanks. Here is my code (NewsContent.aspx): <form id="Form1" method="post" runat="server">
1
1918
by: Suresh | last post by:
Using ASP.NET 1.1 ---------------------- I have a custom collection of object that I'm binding to a datagrid. Each of these objects have another collection inside them. I have a user control that renders the nested collection into html table. See sample code below. Now this binds fine and my sub collections are rendered fine by my user control and list appears as it should. The problem is when I do paging. The sub collections do...
0
8472
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
8390
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
8819
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...
0
7428
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
5690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.