|
-
Aug 18th, 2012, 11:22 AM
#1
Thread Starter
Member
Listview Click Row
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.
-
Aug 18th, 2012, 05:38 PM
#2
Re: Listview Click Row
To calculate number of days (weeks, months, etc) between two dates use DateDiff() function. Search fiorum if you need some sample code.
-
Aug 18th, 2012, 09:03 PM
#3
Thread Starter
Member
Re: Listview Click Row
 Originally Posted by RhinoBull
To calculate number of days (weeks, months, etc) between two dates use DateDiff() function. Search fiorum if you need some sample code.
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...
-
Aug 19th, 2012, 01:15 AM
#4
Re: Listview Click Row
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.
-
Aug 19th, 2012, 04:43 AM
#5
Thread Starter
Member
Re: Listview Click Row
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|