This is in connection with my last thread: http://www.vbforums.com/showthread.p...light-Due-Date
once I select or click a row with a due date value that is already pass, a message box will appear telling me how many days this due has passed.
This is in connection with my last thread: http://www.vbforums.com/showthread.p...light-Due-Date
once I select or click a row with a due date value that is already pass, a message box will appear telling me how many days this due has passed.
To calculate number of days (weeks, months, etc) between two dates use DateDiff() function. Search fiorum if you need some sample code.
Microsoft MVP - Visual Basic 2006-2013
Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database .
Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent .
The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array
Visual Basic 6.0 On-Line Documentation . Connection Strings
Hi RhinoBull,
Thanks for the reply. Yes I'm aware of the DateDiff() function. Problems is for example
Listview:
Invoice Due Date
Inv#A001 August 17, 2012
Inv#A003 September 5, 2012
Inv#A010 September 15, 2012
Inv#A023 September 17, 2012
This is what I want:
If invoice# A001 is selected a message will popup telling me this transaction is already due... If Invoice# A003 or A010 or A023 is selected nothing happens, because it is not yet due...
The simplest method, in your particular case, would be to test whether the due date subitem's colour is vbRed (or whatever colour you have used to higlight it) in the row the user has clicked on. As Rhino has pointed out, if you want to calculate the elapsed period, use the DateDiff Function.
Last edited by Doogle; Aug 19th, 2012 at 01:21 AM.
Thanks guys, figured out the problems, here the code:
Code:Private Sub ListView2_ItemClick(ByVal Item As MSComctlLib.ListItem) 'On Error Resume Next Dim li As ListItem Dim sol2 Dim dateValpass, getdateVal As Date sol2 = ListView2.SelectedItem.Index getdateVal = ListView2.ListItems.Item(sol2).SubItems(5) If getdateVal < Now Then dateValpass = DateDiff("d", getdateVal, Now()) MsgBox "Due date is already " & dateValpass & " days old" End If End Sub