PUBLICIDAD
Wilas

Ayuda de un Hashtable en Visual Basic

willis276

ANÓNIMO
Gente,

Queria ver si me podian ayudar con un problema de Visual Basic, estoy haciendo un hashtable en visual basic, total del 1000 numeros aleatorios, y tambien meterlo en un SortedList, pero quiero mostrarlo en un listview, y no lo logro poder mostrarlo ahi... me podrian ayudar porfa... Aqui esta lo que hice.

`crea todo
Dim Tabla As New Hashtable
Dim Lista As New SortedList()
Dim conta%
Dim elemento As New DictionaryEntry
Dim a, b As Integer

`carga la tabla de tipo hashtable
Sub CargarTabla()
Dim i As Integer
Dim Random As New Random()
For i = 0 To 999
Dim numero As Integer = Random.Next(1, 1001)
Dim numero2 As Integer = Random.Next(1, 1001)
Tabla.Add()
Next
CargarLista()
End Sub
---------------------------------------------------------------------------
`carga la lista tipo hashtable
Sub CargarLista()
Lista.Clear()
conta = 0
Try
For Each Me.elemento In Tabla
a = elemento.Key
b = elemento.Value
Lista.Add(a, b)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
---------------------------------------------------------------------------
`aqui es dnd intentaba que se mostrara en el listview pero no lo logro.

Sub MostrarTabla()
Dim fila = 0
ListView1.Items.Clear()
Dim x As New DictionaryEntry
For Each x In Tabla
ListView1.Items.Add(x.Key)
ListView1.Items(fila).SubItems.Add(x.Value)
fila += 1
Next
End Sub
--------------------------------------------------------------------
Gracias !!!!!!
 
#1 en FACTURA ELECTRÓNICA
Evite multas y sanciones: Presentamos sus declaraciones del IVA D104, de ALQUILERES D125, así como su renta D101 desde $20 al mes.
Active su PLAN PREPAGO por $9.99 y timbre hasta 50 documentos electrónicos. Sin mensualidades, ni anualidades con el sistema líder en el país.
Fondos de Pantalla
Arriba Pie