Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have a listview with the columns Dealer, RecievedDate, ResolvedDate, Aging and Status(active and closed). I need to update all the rows that are still Active, where the Aging is the difference of the Current date and the RecievedDate every load of the form.
Posted
Comments
Sergey Alexandrovich Kryukov 15-May-15 13:33pm    
ListView? Which one? In .NET FCL, there are at least 3 classes under this simple name. Please, give us a full type name.
—SA
Member 11620658 15-May-15 18:08pm    
it is System.Windows.Forms.ListView . I'm sorry im just a newbie..
Sergey Alexandrovich Kryukov 15-May-15 21:26pm    
My congratulations. Many other "newbies" are unable to answer this question. Thank you. (I'm not joking.)
—SA
Member 11620658 15-May-15 13:43pm    
what classes do you mean?
Ravi Bhavnani 15-May-15 14:20pm    
System.Windows.Forms.ListView
System.Windows.Controls.ListView
System.Web.UI.WebControls.ListView

/ravi


1 solution

stebo0728 gave you a pretty good idea. From your question, it looks like you want to use the View = System.Windows.Forms.View.Details.
In many cases, you can get much better results using System.Windows.Forms.DataGridView: https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview%28v=vs.110%29.aspx[^].

You don't need to update the view; it is updated when you modify data, in this case, System.Windows.Forms.DataGridViewCell.Value property:
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.value(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.valuetype(v=vs.110).aspx[^].

Same thing goes with System.Windows.Forms.ListView. The view is changes when you modify ListViewItem or ListViewItem.ListViewSubItem. Please read the documentation carefully, including the code sample, and try it out:
https://msdn.microsoft.com/en-us/library/system.windows.forms.listview%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem.listviewsubitem(v=vs.110).aspx[^].

If you are using the database, first of all, consider using binding. Please see:
https://msdn.microsoft.com/en-us/library/ef2xyb33%28v=vs.90%29.aspx[^],
A Detailed Data Binding Tutorial[^],
Data binding concepts in .NET windows forms[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900