ELIMINAR DE UMA LISTVIEW, PARA ADICIONAR NOUTRA

USUARIO.EXCLUIDOS 28/07/2005 16:17:05
#96450
Dim retirar As Boolean
Dim a As ListItem
retirar = False
If ListView2.ListItems.Count <> 0 Then
t = ListView2.SelectedItem
If Not ListView2.SelectedItem Is Nothing Then
If ListView2.SelectedItem.SubItems(1) = "10" Then
txt_total = txt_total - 10
txt_saldo = txt_saldo + 10
If ListView2.SelectedItem.Text = "Produto X" Then
ListView2.ListItems.Remove ListView2.SelectedItem.Index
retirar = True
Set a = ListView1.ListItems.Add(, , "Produto X")
a.SubItems(1) = "10"
End If
End If
If ListView2.SelectedItem.SubItems(1) = "20" Then
txt_total = txt_total - 20
txt_saldo = txt_saldo + 20
If ListView2.SelectedItem.Text = "Produto Y" Then
ListView2.ListItems.Remove ListView2.SelectedItem.Index
retirar = True
Set b = ListView1.ListItems.Add(, , "Produto Y")
b.SubItems(1) = "20"
End If
End If
End if
End if

----------------------------------------------------------------------------------------------------------------------

ao eliminar o item da listview2, queria q fosse adicionado novamente esse item ah listview1.

esta dando erro : "object variable or with block variable not set"

pq ta dando errado ?

[[[ ]]]
TRUHILLO 28/07/2005 17:00:19
#96462
Veja as respostas neste tópico:

Remover item de um listview
USUARIO.EXCLUIDOS 28/07/2005 18:08:07
#96471
eu ja consigo remover o item da listview2, e adicionar depois na listview1,

mas n consigo acrescentar o subitem ah listview1...

ou seja na listview1 tenho : Produto X | 10

ja consigo adicionar o nome "Produto X" ah listview1, e removar da listview2, mas n consigo eh adicionar o "10" ah listview1, sendo q ja elimina tb da listview2

percebem ?

[[[ ]]]
TRUHILLO 29/07/2005 07:57:37
#96514
Para incluir um subitem no listview faça isso:

listview1.listitems(1).listsubitems.add 1, , "10" 'Quantidade
listview1.listitems(1).listsubitems.add 2, , "9,50" 'Valor

Desculpe pela outra resposta incompleta...
Tópico encerrado , respostas não são mais permitidas