Hi everybody,
I'm currently working on an application using 2 listview-items. I use 2 command-buttons to switch:
Listview1 (LvwDB) is a representation of a general list.
Listview2 (LvwAcc) is a representation of a list with accepted items from Listview1.
Accept-button (BtnAccept) and Remove-button (BtnRemove)
When I push BtnAccept the data of the LvwDB.SelectedItem is copied to LvwAcc and the LvwDB.SelectedItem is ghosted.
When I push BtnRemove LvwAcc.SelectedItem is removed from my list, and ghosted=false.
This works fine until I remove an item from LvwAcc, and try to add an item to LvwAcc. The ListItem associated with LvwAcc doesn't recognize it's index: q1
Can anybody help me solve this problem,
Thanx in advance.
Code:
BtnRemove_Click:
lvwAcc.ListItems.Remove (lvwAcc.SelectedItem.Index)
For s = 1 To lvwDB.ListItems.Count
If lvwDB.ListItems.Item(s).Key = LIKey Then
lvwDB.ListItems.Item(s).ForeColor = RGB(0, 0, 0)
For i = 1 To lvwDB.ListItems.Item(s).ListSubItems.Count
lvwDB.ListItems.Item(s).ListSubItems(i).ForeColor = RGB(0, 0, 0)
Next i
lvwDB.ListItems.Item(s).Ghosted = False
End If
Next s
lvwDB.Refresh
BtnAcc_Click:
dim itmX as ListItem
dim ItmA as Listitem
itmX.Ghosted = True
itmX.ForeColor = RGB(200, 200, 200)
LIKey = itmX.Key
LIText = itmX.Text
LISubVer = itmX.SubItems(1)
LISubCust = itmX.SubItems(2)
LISubDate = itmX.SubItems(3)
Set ItmA = lvwAcc.ListItems.Add(q1, LIKey, LIText, "done", "done")
ItmA.ListSubItems.Add Key:="versionacc" & q1, Text:=LISubVer
ItmA.ListSubItems.Add Key:="customeracc" & q1, Text:=LISubCust
ItmA.ListSubItems.Add Key:="datereq" & q1, Text:=LISubDate
ItmA.ListSubItems.Add Key:="dateacc" & q1, Text:=Date
lvwAcc.Refresh
