Smokeywade
Member
- Joined
- Sep 11, 2007
- Messages
- 22
- Programming Experience
- 3-5
What I'm trying to do in a listview is calculate the time now from a time in the table and place that result into a column on the grid for each record.
I was able to do this great using a datagrid, I'm exploring into the listview world and I cant seem to figure out how to do this...here is my code
Thanks For Any Help
I was able to do this great using a datagrid, I'm exploring into the listview world and I cant seem to figure out how to do this...here is my code
VB.NET:
Function fncDaysOpen()
Dim row As Integer
Try
For row = 0 To Mydataset3.Tables(0).Rows.Count - 1
'Convert DateTime String
Dim order_date As String
order_date = lstGrid.Items(row).SubItems(2).Text
Dim conv As DateTime
conv = System.Convert.ToDateTime(order_date)
Dim d1 As DateTime = conv
Dim d2 As DateTime = System.DateTime.Today
Dim subtract, absday
subtract = 0
Select Case DatePart("w", d1)
Case 1
subtract = subtract + 1
Case 7
subtract = subtract + 2
End Select
Select Case DatePart("w", d2)
Case 1
subtract = subtract + 2
Case 7
subtract = subtract + 1
End Select
absday = DateDiff("d", d1, d2) - 1
fncDaysOpen = absday - CInt(2 * (absday \ 7))
'I get My Error Right Here - when placing results for each rec.
lstGrid.Items(row).SubItems(7).Text = fncDaysOpen
Next row
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function<b></b>
Thanks For Any Help