473,666 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid : IBindingList question

bool A = Is this the right place to ask this question?

if (A)
{
Where can i find a good example of an ArrayList bound to a datagrid that
automatically updates the grid when the public data within the class
contained in the arraylist is updated. i do not want to use
datagrid.refres h() because the data updates randomly and often frequently
and refreshing the whole grid several times a second is expensive and causes
a flicker.
}
else
{
please redirect me to the appropriate newsgroup.
}

thanks
Matt
Nov 17 '05 #1
5 6682
ArrayList does not implement IBindingList which is why it doesn't update the
grid.

The best solution is to create your own IBindingList implementation.

The only framework classes that I know of that implement IBindingList are
DataView and DataViewManager .

Pete
"Matthew Woods" <mw****@bearwag ner.com> wrote in message
news:uG******** *****@TK2MSFTNG P10.phx.gbl...
bool A = Is this the right place to ask this question?

if (A)
{
Where can i find a good example of an ArrayList bound to a datagrid
that
automatically updates the grid when the public data within the class
contained in the arraylist is updated. i do not want to use
datagrid.refres h() because the data updates randomly and often frequently
and refreshing the whole grid several times a second is expensive and
causes
a flicker.
}
else
{
please redirect me to the appropriate newsgroup.
}

thanks
Matt

Nov 17 '05 #2
Thanks,

So is there any way to automatically update a datagrid bound to an
arraylist?

Matt

"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:1N******** *************** *******@giganew s.com...
ArrayList does not implement IBindingList which is why it doesn't update the grid.

The best solution is to create your own IBindingList implementation.

The only framework classes that I know of that implement IBindingList are
DataView and DataViewManager .

Pete
"Matthew Woods" <mw****@bearwag ner.com> wrote in message
news:uG******** *****@TK2MSFTNG P10.phx.gbl...
bool A = Is this the right place to ask this question?

if (A)
{
Where can i find a good example of an ArrayList bound to a datagrid
that
automatically updates the grid when the public data within the class
contained in the arraylist is updated. i do not want to use
datagrid.refres h() because the data updates randomly and often frequently and refreshing the whole grid several times a second is expensive and
causes
a flicker.
}
else
{
please redirect me to the appropriate newsgroup.
}

thanks
Matt


Nov 17 '05 #3
No, there is not. However, you can create a regular wrapper which takes
an ArrayList which implements IBindingList. It wouldn't be too hard.

Also, if you are using .NET 2.0, check out the BindingList<T> class, as
it implements IBindingList, and will give you what you want.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Matthew Woods" <mw****@bearwag ner.com> wrote in message
news:OM******** *****@TK2MSFTNG P15.phx.gbl...
Thanks,

So is there any way to automatically update a datagrid bound to an
arraylist?

Matt

"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:1N******** *************** *******@giganew s.com...
ArrayList does not implement IBindingList which is why it doesn't update

the
grid.

The best solution is to create your own IBindingList implementation.

The only framework classes that I know of that implement IBindingList are
DataView and DataViewManager .

Pete
"Matthew Woods" <mw****@bearwag ner.com> wrote in message
news:uG******** *****@TK2MSFTNG P10.phx.gbl...
> bool A = Is this the right place to ask this question?
>
> if (A)
> {
> Where can i find a good example of an ArrayList bound to a datagrid
> that
> automatically updates the grid when the public data within the class
> contained in the arraylist is updated. i do not want to use
> datagrid.refres h() because the data updates randomly and often frequently > and refreshing the whole grid several times a second is expensive and
> causes
> a flicker.
> }
> else
> {
> please redirect me to the appropriate newsgroup.
> }
>
> thanks
> Matt
>
>



Nov 17 '05 #4
I think you call Refresh() in the CurrencyManager . I'm pretty sure that will
work.

Just do:

(BindingContext[grid.DataSource , grid.DataMember] as
CurrencyManager ).Refresh();

Pete

"Matthew Woods" <mw****@bearwag ner.com> wrote in message
news:OM******** *****@TK2MSFTNG P15.phx.gbl...
Thanks,

So is there any way to automatically update a datagrid bound to an
arraylist?

Matt

"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:1N******** *************** *******@giganew s.com...
ArrayList does not implement IBindingList which is why it doesn't update

the
grid.

The best solution is to create your own IBindingList implementation.

The only framework classes that I know of that implement IBindingList are
DataView and DataViewManager .

Pete
"Matthew Woods" <mw****@bearwag ner.com> wrote in message
news:uG******** *****@TK2MSFTNG P10.phx.gbl...
> bool A = Is this the right place to ask this question?
>
> if (A)
> {
> Where can i find a good example of an ArrayList bound to a datagrid
> that
> automatically updates the grid when the public data within the class
> contained in the arraylist is updated. i do not want to use
> datagrid.refres h() because the data updates randomly and often frequently > and refreshing the whole grid several times a second is expensive and
> causes
> a flicker.
> }
> else
> {
> please redirect me to the appropriate newsgroup.
> }
>
> thanks
> Matt
>
>



Nov 17 '05 #5
Calling CurrencyManager .Refresh() will cause it to resync with the
datasource, allowing it to pick up the changes. There are problems with
this, and I agree, wrapping ArrayList and implementing IBindingList is far
preferable.

Pete

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:Oc******** ******@tk2msftn gp13.phx.gbl...
No, there is not. However, you can create a regular wrapper which
takes an ArrayList which implements IBindingList. It wouldn't be too
hard.

Also, if you are using .NET 2.0, check out the BindingList<T> class, as
it implements IBindingList, and will give you what you want.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Matthew Woods" <mw****@bearwag ner.com> wrote in message
news:OM******** *****@TK2MSFTNG P15.phx.gbl...
Thanks,

So is there any way to automatically update a datagrid bound to an
arraylist?

Matt

"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:1N******** *************** *******@giganew s.com...
ArrayList does not implement IBindingList which is why it doesn't update

the
grid.

The best solution is to create your own IBindingList implementation.

The only framework classes that I know of that implement IBindingList
are
DataView and DataViewManager .

Pete
"Matthew Woods" <mw****@bearwag ner.com> wrote in message
news:uG******** *****@TK2MSFTNG P10.phx.gbl...
> bool A = Is this the right place to ask this question?
>
> if (A)
> {
> Where can i find a good example of an ArrayList bound to a datagrid
> that
> automatically updates the grid when the public data within the class
> contained in the arraylist is updated. i do not want to use
> datagrid.refres h() because the data updates randomly and often

frequently
> and refreshing the whole grid several times a second is expensive and
> causes
> a flicker.
> }
> else
> {
> please redirect me to the appropriate newsgroup.
> }
>
> thanks
> Matt
>
>



Nov 17 '05 #6

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

Similar topics

2
2742
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...
0
2367
by: David Elliott | last post by:
I have a Collection that inherits from CollectionBase and Implements IBindingList which I have bound to a DataGrid. So far everything works fine. However, I am missing one piece to the IBindingList that I haven't figured out yet, how to determine which DataGrid column header I clicked on so I can do a custom sort. Right now the sort is rotating just to see that everything works. There are two pieces of the IBindingList that I didn't...
5
2527
by: K | last post by:
I created a collection which is derived from ArrayList and implements IBindingList and ITypedList. Then I bound the DataSource of a data grid into the collection. It could show up the data but the column heading is not in the right order, for eg. I want "ID" column to be the first column but it showed as the second column. Another problem is that anyway i can leave a blank row in the grid to add a new row automatically if the user...
7
4223
by: Pete Davis | last post by:
A different question this time. I have a DataGrid bound to a collection. Is there any way for me to allow sorting? The DataGrid.AllowSorting=true doesn't work, but that's probably because it can't assume the data types and thus can't sort them. I thought about implementing IComparable, but I don't see how that would work since it doesn't apply generically to all the fields/properties of the class. Thanks.
3
1788
by: Matthew Woods | last post by:
Hi, is there any way to format and order the columns displayed in a datagrid bound to a class that inherits from IBindingList? i have used DataGridTableStyle and added DataGridTextBoxColumns to it in the correct order which works fine if the dataGrid.dataSource = "ArrayList", but it doesn't work for my IBindingList wrapper. If i bind the datasource to the arraylist method then the ListChangedEventHandler is never invoked and my grid only...
0
929
by: Narshe | last post by:
I have a collection that implements IBindingList and I have it bound to a datagrid. It was my understanding that the datagrid would handle everything once IBindingList was implemented, but this doesn't seem to be the case. When the grid is sorted, ApplySort is never called. Now I'm assuming the datagrid doesn't call ApplySort, and in the sort command event, I just need to call it myself. Is this correct? Or should the datagrid be...
2
1388
by: Jon | last post by:
My application needs to present data generated at run time in a datagrid that can be sorted by clicking on columns, and where rows can be selected and events generated. Do I need to set up a dataset and datatable to do this or can I do this through arrays (which I believe can not be sorted in a datagrid)? Can anyone point me towards any samples or in the right direction? thanks much - Jon
0
927
by: Nathan Carroll | last post by:
Attempting to bind a collection base to a datagrid. Cannot get the 'new row' in datagrid and when I attempt to use a button to add a new item to collection datagrid does not show the newly created unless I unbind it and rebind it. I have the following implemented through Implements System.ComponentModel.IBindingList: Public Function AddNew() As Object Implements System.ComponentModel.IBindingList.AddNew Dim c As New Item...
16
2018
by: stojilcoviz | last post by:
I've a datagrid whose datasource is an arraylist object. The arraylist holds many instances of a specific class. I've two questions about this: 1 - Is there a way by which I can obtain a reference to the arraylist item the current row points to? 2 - Is it possible to sort the grid? Many thanks in advance.
0
8443
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
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7385
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...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
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
4198
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
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
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
1772
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.