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 !!!!!!
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 !!!!!!