Como pasar variable a listbox en visual net
Un amigo me pidió que le ayudara a mostrar los resultados de una combinación en un listbox en visual net pero mis conocimientos son escasos en este tipo de lenguaje jejej
Bueno el código
Public Class Form1 Dim combinations As Integer Dim seta As Integer ReadOnly constantValues As New List(Of Integer) From { 2I, 3I, 5I, 6I, 7I, 8I, 9I, 11, 13, 14, 17, 18, 19, 20, 21, 24, 25, 26, 29, 30, 31, 33, 44, 48 } Private Shadows Sub Load() Handles MyBase.Load Dim combinations As New List(Of Integer()) Dim length As Integer = 5 Dim skipStart As Integer = 0 Do Until skipStart = (constantValues.Count - length) Dim values As List(Of Integer) = constantValues.GetRange(skipStart, length) Dim count As Integer = 0 Do Until count = (constantValues.Count - length - skipStart) combinations.Add(values.Concat(constantValues.Skip(skipStart + length + count).Take(1)).ToArray) Debug.WriteLine(String.Join(", ", values.Concat(constantValues.Skip(skipStart + length + count).Take(1)).ToArray)) count += 1 Loop ' count = (constantValues.Count - length) skipStart += 1 Loop ' skipStart = (constantValues.Count - length) End Sub End Class