473,394 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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.ComponentModel.PropertyChangedEventHandler
QuantityChanged;
private int quantity;
[System.ComponentModel.Bindable(true)]
public int Quantity
{
get { return quantity; }
set
{
if (quantity != value)
{
quantity = value;
if (QuantityChanged != null)
QuantityChanged(this, new
System.ComponentModel.PropertyChangedEventArgs("Qu antity") );
}
}
}

Property Quantity is modified through code and datagrid quantity is not
automatically refreshed (QuantityChanged 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.QuantityChanged += new
PropertyChangedEventHandler(refresh_method);

....

private void refresh_method()
{
myDataGrid.Refresh();
}

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

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

Similar topics

0
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...
2
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....
3
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...
3
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...
3
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...
11
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...
1
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...
1
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...

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.