Public Class PasoentreListas Private Sub PasoentreListas_Load

Anuncio
Public Class PasoentreListas
Private Sub PasoentreListas_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
lbOrigen.Items.Clear()
lbDestino.Items.Clear()
For i = 1 To 20
lbOrigen.Items.Add(i.ToString("000"))
Next
btnEnviar.Enabled = False
btnRecibir.Enabled = False
End Sub
Private Sub lbOrigen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lbOrigen.Click
If lbOrigen.SelectedItems.Count > 0 Then
btnEnviar.Enabled = True
Else
btnEnviar.Enabled = False
End If
btnRecibir.Enabled = False
End Sub
Private Sub lbDestino_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lbDestino.Click
If lbDestino.SelectedItems.Count > 0 Then
btnRecibir.Enabled = True
Else
btnRecibir.Enabled = False
End If
btnEnviar.Enabled = False
End Sub
Private Sub btnEnviar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnEnviar.Click
Dim i, num As Integer
Dim elemento As String
num = lbOrigen.Items.Count - 1
For i = 0 To num
If lbOrigen.GetSelected(i) = True Then
elemento = lbOrigen.Items(i)
lbDestino.Items.Add(elemento)
End If
Next
For i = num To 0 Step -1
If lbOrigen.GetSelected(i) = True Then
lbOrigen.Items.RemoveAt(i)
End If
Next
btnEnviar.Enabled = False
End Sub
Private Sub btnRecibir_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRecibir.Click
Dim i, num As Integer
Dim elemento As String
num = lbDestino.Items.Count - 1
For i = 0 To num
If lbDestino.GetSelected(i) = True Then
elemento = lbDestino.Items(i)
lbOrigen.Items.Add(elemento)
End If
Next
For i = num To 0 Step -1
If lbDestino.GetSelected(i) = True Then
lbDestino.Items.RemoveAt(i)
End If
Next
btnRecibir.Enabled = False
End Sub
Private Sub btnTodos1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnTodos1.Click
Dim i, num As Integer
Dim valor As Boolean
num = lbOrigen.Items.Count - 1
valor = True
'SELKECCIONA TODA LA LISTA
For i = 0 To num
lbOrigen.SetSelected(i, valor)
Next
btnRecibir.Enabled = False
If lbOrigen.SelectedItems.Count > 0 Then
btnEnviar.Enabled = True
Else
btnEnviar.Enabled = False
End If
lbOrigen.TopIndex = 0
End Sub
Private Sub btnTodos2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnTodos2.Click
Dim i, num As Integer
Dim valor As Boolean
num = lbDestino.Items.Count - 1
valor = True
'SELKECCIONA TODA LA LISTA
For i = 0 To num
lbDestino.SetSelected(i, valor)
Next
btnEnviar.Enabled = False
If lbDestino.SelectedItems.Count > 0 Then
btnRecibir.Enabled = True
Else
btnRecibir.Enabled = False
End If
lbDestino.TopIndex = 0
End Sub
End Class
Descargar