我正在構建一個系統,用於檢查項目是否接近其到期日期。VB6.0將日期與列表視圖子項中的數據進行比較
我仍然使用find方法發生錯誤。錯誤說,無效的屬性值
Private Sub Command1_Click()
Dim strCurrDate As String
strCurrDate = Format(Date, "MM/dd/yyyy")
Dim list As ListItem
Dim x As Integer
ConnectDB
rs.Open "Select * from Table1 Order by Expiry ASC", db, 3, 3
Do Until rs.EOF
Set list = ListView1.ListItems.Add(, , rs(0))
For x = 1 To 3
list.SubItems(x) = rs(x)
Next x
rs.MoveNext
Loop
Set rs = Nothing
db.Close: Set db = Nothing
ListView1.ListItems.Clear
Set list = Me.ListView1.FindItem(strCurrDate, lvwSubItem, 1, lvwPartial) ' Error here
If Not list Is Nothing Then
'Select the row
list.Selected = True
'Auto scrolling the Scrollbar if we have so much rows
'and not show on ListView
myList.EnsureVisible
MsgBox "Data Found:"
Else
MsgBox "Data not Found"
End If
End Sub
我添加了它,因爲它將顯示的記錄加倍。 甚至我刪除它。它仍然說沒有找到數據。 最新的問題? – Francis