|
Ahh, the List<t> class implements IList, and not the IBindingList interface. IBindingList fires a ListChanged event that informs the BindingSource to which it is bound, and subsequently the DataGrid to which that BindingSource is bound, that it should update. IList fires no such event, so the BindingSource never knows that it should update itself.
My solution to the same problem was to create a class that derives from System.Collections.CollectionBase and implements IBindingList, and use it in lieu of an IList-based List.
--
I've killed again, haven't I?
|
|
|
|
|
Hmmm... would this refresh only the changed cells in the grid, or does it refresh the whole thing anyway?
|
|
|
|
|
If I'm not mistaken, I believe it refreshes the row containing the element that was changed.
--
I've killed again, haven't I?
|
|
|
|
|
OK... I've changed the List to a BindingList, but when I make changes to the Properties, it doesn't update on the DataGridView. Is there a way I can trigger that event?
|
|
|
|
|
There are probably a few ways to do it. My collection objects trigger the ListChanged event via a call to the collection class that contains them.
--
I've killed again, haven't I?
|
|
|
|
|
Instead of creating my own implementation of the IBindingList interface, I used the BindingList class. When I was updating the properties of the objects in the list, it was not triggering the ListChanged event. When I looked at ListChanged in help, it mentioned that it will only be fired by items in the list that implement the INotifyPropertyChanged interface.
I added INotifyPropertyChanged to my object class and had it trigger the PropertyChanged event when one of the properties I was interested in changed. This resolved both the issue with the grid not updating and the flickering issue I was having before.
Thanks for all of your help. You never mentioned the INotifyPropertyChanged interface, so if you haven't heard about it until now, I'd suggest giving it a look.
|
|
|
|
|
Glad to be of help!
I've never used INotifyPropertyChanged. It looks like that would get me the same effect as the manual way without having to register the collection class to the collected object. Learning is fun! Thanks!
--
I've killed again, haven't I?
|
|
|
|
|
As far as the flickering goes, i think you should just enable double buffering. Here'a an example for a data grid:
public class myDataGridClass : DataGrid
{
public myDataGridClass()
{
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint , true);
this.UpdateStyles();
}
}
Then, instead of using a DataGrid object you would simply use a myDataGrid object that has the DoubleBuffer flag set to true.
|
|
|
|
|
I have a comboBox with some data from a database (the comboBox is populated from the wizard). let's say I add some more data in the database. How can I refresh the data from the comboBox? Do I have to add the new data manualy?
Thanks!
|
|
|
|
|
If the combobox is databound, it will automatically update from your dataset.
|
|
|
|
|
ok, then how do I refresh the dataset?
|
|
|
|
|
IF the dataset is untyped you fill it in yourself using Datarows.
If you've typed it to a database, you use DA.Fill (dataadapter.fill)
|
|
|
|
|
Hi,
Does anyone know of an open source .NET diagram framework that provides Visio like capabilities?
I used GoDiagram in the past, and it was very good (in a commercial product), but it is a commercial product and I need diagrammatic capabilities for a non commercial project.
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
-- modified at 11:17 Monday 12th June, 2006
|
|
|
|
|
|
Hi Senthil,
Very impressing! (You can always count on CodeProject members )
Thank you, I am looking at it right now.
Looks like a good candidate to start with.
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
hi all,
i want to parse this text:
******************** CASE OPENNING RECORDS OF 80 ENTRIES ********************
***************** (MONTH/DAY-HOUR:MINUTE:SECOND-#AUTHORITY) *****************
------------------------------- CASE NO: 8888 -------------------------------
05/12-17:25:05-#3 05/12-17:24:56-#3 05/12-17:24:44-#0 05/12-17:24:32-#3
05/12-17:24:22-#3
---------------------------------- DATA END ---------------------------------
and get values as:
8888
05/12 17:25:05 #3
05/12 17:24:56 #3
05/12 17:24:44 #0
05/12 17:24:32 #3
05/12 17:24:22 #3
help please ?
|
|
|
|
|
You can use regular expressions and string.Split() . If you have a specific question, please post it, but don't ask us to do your work for you.
Logifusion[^]
|
|
|
|
|
|
Hy,
I need a little more help . I have a DLL created in C++ which has some methods that interest me. Now I want to use this DLL in C# so I created another DLL in C# which uses the one made in C++. Only I have a few problem. Most of the methods from the C++ DLL need pointers as parameters. For example one method in C++ needs a BYTE* as parameter. I tried from C# to send a BYTE[] but it doen't help me. I also tried with REF but it still doesn't work. If I return a BYTE* from C++ and read it into a BYTE[] an error occurs "Can Not marshal return value".
A little help will be welcomed. Thanks
|
|
|
|
|
could you paste the C++ definition and your c# definition please.
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
How can i work with a Timer Control in ASP.NET?
....
....
Thanks
|
|
|
|
|
From what i know only ATLAS gives the ability to work with Timers. Also there always is JavaScript but that is on the client side.
Hope it helps (http://atlas.asp.net - for more details)
|
|
|
|
|
You could use the following:
Use System.Timers.Timer class for your timer and add a static instance of the class to your webform. (Static because you want it to run on the server on not getting initilized when a user requests something on the client). To help you a bit on that here's my code which worked for me:
<br />
public class TimerClass<br />
{<br />
System.Timers.Timer timer = new System.Timers.Timer();<br />
public TimerClass(double interval, bool enabled, params System.Timers.ElapsedEventHandler[] fto)<br />
{<br />
timer.Interval = interval;<br />
timer.Enabled = enabled;<br />
for (int i = 0; i < fto.Length; i++)<br />
{<br />
timer.Elapsed += fto[i];<br />
}<br />
timer.Start();<br />
}<br />
}<br />
<br />
public class WebForm1 : System.Web.UI.Page<br />
{<br />
protected static TimerClass MyTimer = new TimerClass(1000, true, new System.Timers.ElapsedEventHandler(MyTimer_Elapsed));
}<br />
Hope this helps.
Greetings
|
|
|
|
|
:hi all, to attach a file i use the html file field in my web application but it only accept upto 10mb file but i need to allow the user to attach more than 10mb file in my web application..is there any way to do this ...hlp plz....
thanks in advance
Regard,
ayyp
|
|
|
|
|
:hi all, to attach a file i use the html file field in my web application but it only accept upto 10mb file but i need to allow the user to attach more than 10mb file in my web application..is there any way to do this ...hlp plz....
thanks in advance
Regard,
ayyp
|
|
|
|