Mis malas combinaciones :(

Iniciado por luis456, 9 Agosto 2014, 15:07 PM

0 Miembros y 1 Visitante están viendo este tema.

Eleкtro

1) pon el código entero que estás usando

2) a la variable FixedValues asignale manualmente los numeros que tocan ( que no lo tenga q hacer yo porque no los se :-/ ) para probar el For.

3) pon el output que debería dar al menos las primeras 3 combinaciones para saber por donde corregir el problema...

saludos!








luis456

Hola pongo el código entero, lo de poner los números en la variable es como difícil sin tener que cortar el código, que como veras hace una serie de cálculos con 20 dígitos que introduzco y saber cuantos números salen de esa ecuación es un poco difícil


Codigo

Código (vbnet) [Seleccionar]
Public Class Form1
    Dim maximum As Short = 99
    Dim Número As Double
    Private TextBoxes As TextBox() = {Nothing}
    Private Result1 As Int32(), Result2 As Int32(), Result3 As Int32(), Result4 As Int32(), Result5 As Int32(), Result6 As Int32(), Result7 As Int32(), Result8 As Int32(), Result9 As Int32(), Result10 As Int32(), Result11 As Int32(), Result12 As Int32(), Result13 As Int32(), Result14 As Int32(), Result15 As Int32(), Result16 As Int32(), Result17 As Int32(), Result18 As Int32(), Result19 As Int32(), Result20 As Int32()
    Private _textBox As Object
    ReadOnly MAX As Integer = 99
    Dim Rand As New Random
    Dim Rand2 As New Random
    Dim Result22 As Integer
    Dim Counter, Counter2 As Integer
    Dim myLabelArray(6) As Label
    Dim x As Integer = 0
    Private Property ListBox1Count As Integer
    ReadOnly Randomizer As New Random
    Dim Combo As List(Of Integer) = Nothing
    Dim Combos As New List(Of List(Of Integer))
    Dim FixedValues As Integer() = Nothing
    ReadOnly RandomValues As Integer() =
        Enumerable.Range(0, 99).ToArray

    Public Sub solonumeros(ByRef e As System.Windows.Forms.KeyPressEventArgs)
        ' evitar letras
        If Char.IsDigit(e.KeyChar) Then
            e.Handled = False
        ElseIf Char.IsControl(e.KeyChar) Then
            e.Handled = False
        ElseIf Char.IsSeparator(e.KeyChar) Then
            e.Handled = False
        Else
            e.Handled = True
        End If

    End Sub

    Private Property Calcular As Object

    Private Property TextBox(ByVal TextBoxCount As Short) As Object
        Get
            Return _textBox
        End Get
        Set(ByVal value As Object)
            _textBox = value
        End Set
    End Property

    ReadOnly Property Num1 As Int32
        Get
            Return CInt(TextBox1.Text)
        End Get
    End Property
    ReadOnly Property Num2 As Int32
        Get
            Return CInt(TextBox2.Text)
        End Get
    End Property
    ReadOnly Property Num3 As Int32
        Get
            Return CInt(TextBox3.Text)
        End Get
    End Property
    ReadOnly Property Num4 As Int32
        Get
            Return CInt(TextBox4.Text)
        End Get
    End Property

    ReadOnly Property Num5 As Int32
        Get
            Return CInt(TextBox5.Text)
        End Get
    End Property
    '---------------------------------
    ReadOnly Property Num6 As Int32
        Get
            Return CInt(TextBox6.Text)
        End Get
    End Property

    ReadOnly Property Num7 As Int32
        Get
            Return CInt(TextBox7.Text)
        End Get
    End Property
    ReadOnly Property Num8 As Int32
        Get
            Return CInt(TextBox8.Text)
        End Get
    End Property
    ReadOnly Property Num9 As Int32
        Get
            Return CInt(TextBox9.Text)
        End Get
    End Property
    ReadOnly Property Num10 As Int32
        Get
            Return CInt(TextBox10.Text)
        End Get
    End Property
    ReadOnly Property Num11 As Int32
        Get
            Return CInt(TextBox11.Text)
        End Get
    End Property
    ReadOnly Property Num12 As Int32
        Get
            Return CInt(TextBox12.Text)
        End Get
    End Property
    ReadOnly Property Num13 As Int32
        Get
            Return CInt(TextBox13.Text)
        End Get
    End Property
    ReadOnly Property Num14 As Int32
        Get
            Return CInt(TextBox14.Text)
        End Get
    End Property
    ReadOnly Property Num15 As Int32
        Get
            Return CInt(TextBox15.Text)
        End Get
    End Property

    ReadOnly Property Num16 As Int32
        Get
            Return CInt(TextBox16.Text)
        End Get
    End Property
    ReadOnly Property Num17 As Int32
        Get
            Return CInt(TextBox17.Text)
        End Get
    End Property
    ReadOnly Property Num18 As Int32
        Get
            Return CInt(TextBox18.Text)
        End Get
    End Property
    ReadOnly Property Num19 As Int32
        Get
            Return CInt(TextBox19.Text)
        End Get
    End Property
    ReadOnly Property Num20 As Int32
        Get
            Return CInt(TextBox20.Text)
        End Get
    End Property

    Private Sub Sumar(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        '--------------------------------------------------
        Dim Result1 As Integer() = {Num1 - 1, Num1 - 2, Num1 - 3, Num1 + 1, Num1 + 2, Num1 + 3}

        For Index As Integer = 0 To (Result1.Count - 1)

            Select Case Result1(Index)

                Case Is = 0 ' El valor es 0. esto todavia no me funciona
                    ' Hacer algo con el número 0 aquí. no mostrar el 0
                    '   Result1(Index) = Not 0

                Case Is < 0 ' El valor es negativo.
                    ' Lo convierto a positivo si funciona.
                    Result1(Index) = Math.Abs(Result1(Index))

            End Select '/ Result1(Index)


        Next Index

        Result1 = Result1.Distinct().ToArray
        Array.Sort(Result1)

        '---------------------------------------------------

        Result2 = {Num2 + 1, Num2 + 2, Num2 + 3, Num2 - 1, Num2 - 2} _
                  .Distinct().ToArray
        Array.Sort(Result2)

        Result3 = {Num3 + 1, Num3 + 2, Num3 + 3, Num3 - 1, Num3 - 2, Num3 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result3)

        Result4 = {Num4 + 1, Num4 + 2, Num4 + 3, Num4 - 1, Num4 - 2, Num4 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result4)

        Result5 = {Num5 + 1, Num5 + 2, Num5 + 3, Num5 - 1, Num5 - 2, Num5 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result5)

        Result6 = {Num6 + 1, Num6 + 2, Num6 + 3, Num6 - 1, Num6 - 2, Num6 - 3} _
                  .Distinct().ToArray

        Array.Sort(Result6)

        Result7 = {Num7 + 1, Num7 + 2, Num7 + 3, Num7 - 1, Num7 - 2, Num7 - 3} _
                  .Distinct().ToArray

        Array.Sort(Result7)

        Result8 = {Num8 + 1, Num8 + 2, Num8 + 3, Num8 - 1, Num8 - 2, Num8 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result8)

        Result9 = {Num9 + 1, Num9 + 2, Num9 + 3, Num9 - 1, Num9 - 2, Num9 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result9)

        Result10 = {Num10 + 1, Num10 + 2, Num10 - 1, Num10 - 2, Num10 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result10)

        Result11 = {Num11 + 1, Num11 + 2, Num11 + 3, Num11 - 1, Num11 - 2, Num11 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result11)

        Result12 = {Num12 + 1, Num12 + 2, Num12 + 3, Num12 - 1, Num12 - 2, Num12 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result12)

        Result13 = {Num13 + 1, Num13 + 2, Num13 + 3, Num13 - 1, Num13 - 2, Num13 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result13)

        Result14 = {Num14 + 1, Num14 + 2, Num14 + 3, Num14 - 1, Num14 - 2, Num14 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result14)

        Result15 = {Num15 + 1, Num15 + 2, Num15 + 3, Num15 - 1, Num15 - 2, Num15 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result15)

        Result16 = {Num16 + 1, Num16 + 2, Num16 + 3, Num16 - 1, Num16 - 2, Num16 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result16)

        Result17 = {Num17 + 1, Num17 + 2, Num17 + 3, Num17 - 1, Num17 - 2, Num17 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result17)

        Result18 = {Num18 + 1, Num18 + 2, Num18 + 3, Num18 - 1, Num18 - 2, Num18 - 3} _
                  .Distinct().ToArray
        Array.Sort(Result18)

        Result19 = {Num19 + 1, Num19 + 2, Num19 + 3, Num19 - 1, Num19 - 2, Num19 - 3} _
                  .Distinct().ToArray

        Array.Sort(Result19)
        Result20 = {Num20 + 1, Num20 + 2, Num20 + 3, Num20 - 1, Num20 - 2, Num20 - 3} _
                  .Distinct().ToArray

        Array.Sort(Result20)
        ' Elimino duplicados al mismo tiempo que selecciono los números inferiores a MAX.
        Dim Resultss As IEnumerable(Of Integer) =
            (
                From Value As Integer
                In (Result1.Concat(Result2).Concat(Result3).Concat(Result4).Concat(Result5).Concat(Result6).Concat(Result7).Concat(Result8).Concat(Result9).Concat(Result10).Concat(Result11).Concat(Result12).Concat(Result13).Concat(Result14).Concat(Result15).Concat(Result16).Concat(Result17).Concat(Result18).Concat(Result19).Concat(Result20)).Distinct
                Where Value <= MAX
            )

        ListBox2.Items.AddRange(Resultss.Cast(Of Object).ToArray)

        'funcion unir combis
        FixedValues =
             ((Result1.Concat(Result2).Concat(Result3).Concat(Result4).Concat(Result5).Concat(Result6).Concat(Result7).Concat(Result8).Concat(Result9).Concat(Result10).Concat(Result11).Concat(Result12).Concat(Result13).Concat(Result14).Concat(Result15).Concat(Result16).Concat(Result17).Concat(Result18).Concat(Result19).Concat(Result20)).Distinct).
             Distinct.
             Select(Function(Value As Integer)
                        Return If(Value < MAX, Value, Rand.Next(0, MAX))
                    End Function).ToArray

        Dim IndexCounter As Integer = FixedValues.First ' 1
        Dim LenCounter As Integer = 0I

        Const NumStep As Integer = 3I
        Const NumLen As Integer = 10I

        Do Until IndexCounter > FixedValues.Last

            Combo = New List(Of Integer)


            For Num As Integer = IndexCounter To (FixedValues.Count - 1I) Step NumStep

                LenCounter += 1I
                Combo.Add(FixedValues(Num - 1I)) 'matrix fuersa

                If LenCounter >= NumLen Then
                    Exit For
                End If

            Next Num

            If LenCounter < NumLen Then

                For RandomNum As Integer = 1I To (NumLen - LenCounter)

                    Dim n As Integer = Randomizer.Next(RandomValues.First, RandomValues.Last)

                    Do Until Not Combo.Contains(n)
                        n = Randomizer.Next(RandomValues.First, RandomValues.Last)
                    Loop

                    Combo.Add(n)

                Next ' RandomNum

            End If ' LenCounter < NumLen

#If DEBUG Then ' #Debug
            Debug.WriteLine(String.Join(", ", Combo))
            ' Stop
#End If
            Combo.Sort()
            Combos.Add(Combo)
            IndexCounter += 1I
            LenCounter = 0I

        Loop ' IndexCounter >= FixedValues.Last

        ' ******** ordenamiento-------------
        '  Dim values As Integer() = (From n As Integer In Combos Order By n Ascending).ToArray

        ' ********
        ' Listbox:
        ' ********
        Combos.ForEach(Sub(comb As List(Of Integer))

                           ' Convierto la Lista a 'String', le añado los ceros, y añado el string formateado al Listbox.
                           ListBox1.Items.Add(String.Join(", ",
                                                          From value As String In comb
                                                          Select If(value.Length = 1I,
                                                                    value.Insert(0I, "0"c),
                                                                    value)))
                           ListBox1.Sorted = True



                       End Sub)

    End Sub


        ' Application.Exit()

    Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        sender.text = System.Text.RegularExpressions.Regex.Replace(sender.text, "\D", "")

    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        sender.text = System.Text.RegularExpressions.Regex.Replace(sender.text, "\D", "")
    End Sub

    Private Sub TextBox4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        sender.text = System.Text.RegularExpressions.Regex.Replace(sender.text, "\D", "")
    End Sub

    Private Sub TextBox5_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        sender.text = System.Text.RegularExpressions.Regex.Replace(sender.text, "\D", "")
    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        sender.text = System.Text.RegularExpressions.Regex.Replace(sender.text, "\D", "")
    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")
        End If
    End Sub

    Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")
        End If
    End Sub
    Private Sub TextBox6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox7_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox7.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub

    Private Sub TextBox8_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox8.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub

    Private Sub TextBox9_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox9.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox10_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox10.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub

    Private Sub TextBox11_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox11.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox12_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox12.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox13_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox13.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox14_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox14.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox15_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox15.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox16_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox16.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox17_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox17.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox18_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox18.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox19_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox19.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub
    Private Sub TextBox20_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox20.KeyPress
        solonumeros(e)
        If e.KeyChar = ChrW(Keys.Enter) Then
            e.Handled = True
            SendKeys.Send("{TAB}")

        End If

    End Sub

    Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        For Each obj As Control In Me.Controls
            If (TypeOf obj Is TextBox) Then
                obj.Text = ""
            End If
            If (TypeOf obj Is GroupBox) Then
                For Each caja As Control In obj.Controls
                    If (TypeOf caja Is TextBox) Then
                        caja.Text = ""
                    End If
                Next
            End If
            ListBox1.Items.Clear()
           
           
        Next
    End Sub

End Class






Que tu sabiduria no sea motivo de Humillacion para los demas

Eleкtro

Cita de: luis456 en 29 Agosto 2014, 18:09 PM
Hola pongo el código entero, lo de poner los números en la variable es como difícil sin tener que cortar el código, que como veras hace una serie de cálculos con 20 dígitos que introduzco y saber cuantos números salen de esa ecuación es un poco difícil

ya, el programa hace el cálculo, ¿pero para que pueda buscar el error no puedes ponerme algo así?:

Dim fixedvalues as integer() = {1,2,3 etc,...}

Si no no se con que números debería probar en el for...

cuando pueda le echo un ojo

saludos








luis456

#43
Con esta secuencia de numeros me da el error


Código (vbnet) [Seleccionar]
Dim fixedvalues as integer() = {02, 03, 11, 12, 16, 18, 25, 27, 28, 31,40, 41, 43, 52, 53, 56, 57, 70, 77, 80}  

Luis




[ELEKTRO]: Mañana lo miro con calma luis, lo siento si te hice esperar
Que tu sabiduria no sea motivo de Humillacion para los demas

Eleкtro

#44
He probado el For con la secuencia que dijiste y no me da ningún error de tipo " Índice fuera de los límites de la matriz ", así que no le hice ninguna modificación al código, está todo correcto en este código? (fixedvalues, numstep, numlen, IndexCounter):

Código (vbnet) [Seleccionar]
Public Class Form1

   ReadOnly Randomizer As New Random

   Private Sub Sumar(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Shown

       Dim Combo As List(Of Integer) = Nothing
       Dim Combos As New List(Of List(Of Integer))

       Dim fixedvalues As Integer() = {2, 3, 11, 12, 16, 18, 25, 27, 28, 31, 40, 41, 43, 52, 53, 56, 57, 70, 77, 80}
       Dim RandomValues As Integer() = Enumerable.Range(0, 99).ToArray

       Dim IndexCounter As Integer = fixedvalues.First ' 1
       Dim LenCounter As Integer = 0I

       Const NumStep As Integer = 3I
       Const NumLen As Integer = 10I

       Do Until IndexCounter > fixedvalues.Last

           Combo = New List(Of Integer)

           For Num As Integer = IndexCounter To (fixedvalues.Count - 1I) Step NumStep

               LenCounter += 1I
               Combo.Add(fixedvalues(Num - 1I)) 'matrix fuersa

               If LenCounter >= NumLen Then
                   Exit For
               End If

           Next Num

           If LenCounter < NumLen Then

               For RandomNum As Integer = 1I To (NumLen - LenCounter)

                   Dim n As Integer = Randomizer.Next(RandomValues.First, RandomValues.Last)

                   Do Until Not Combo.Contains(n)
                       n = Randomizer.Next(RandomValues.First, RandomValues.Last)
                   Loop

                   Combo.Add(n)

               Next ' RandomNum

           End If ' LenCounter < NumLen

           Combo.Sort()
           Combos.Add(Combo)
           IndexCounter += 1I
           LenCounter = 0I

       Loop ' IndexCounter >= FixedValues.Last

       Combos.ForEach(Sub(comb As List(Of Integer))

                          ' Convierto la Lista a 'String', le añado los ceros, y añado el string formateado al Listbox.
                          ListBox1.Items.Add(String.Join(", ",
                                                         From value As String In comb
                                                         Select If(value.Length = 1I,
                                                                   value.Insert(0I, "0"c),
                                                                   value)))
                          ListBox1.Sorted = True



                      End Sub)

   End Sub

End Class


saludos








luis456

 :-X :-X :-X :-X :-X :-X :rolleyes: :rolleyes: :rolleyes: :rolleyes:

Vere que pasa sera otra cosa

gracias

Luis
Que tu sabiduria no sea motivo de Humillacion para los demas

luis456

Bien lo he probado repasado y parece que ya el error no me lo hace realmente no se como se arreglo jejej,lo que hice fue hacer un nuevo proyecto lo renombre y ahora va bien salvo jjejjj siempre hay un pero,

Como hago para que en las  combinaciones no me salga 00

00 10 25 35 48 49 50 51 70 72 90
00 15 25 38 45 48 49 52 56 70 88

Saludos
Luis
Que tu sabiduria no sea motivo de Humillacion para los demas

Eleкtro

#47
Cita de: luis456 en  1 Septiembre 2014, 17:44 PMComo hago para que en las  combinaciones no me salga 00

Código (vbnet) [Seleccionar]

       Combos.ForEach(Sub(comb As List(Of Integer))

                         ' Convierto la Lista a 'String', le añado los ceros, y añado el string formateado al Listbox.
                         ListBox1.Items.Add(String.Join(", ",
                                                        From value As String In comb
                                                        Select If(value.Length = 1I,
                                                                  value.Insert(0I, "0"c),
                                                                  value)))
                         ListBox1.Sorted = True



                     End Sub)

Supongo que te refieres a poner "0" y no "00", entonces:

Código (vbnet,6) [Seleccionar]
       Combos.ForEach(Sub(comb As List(Of Integer))

                         ' Convierto la Lista a 'String', le añado los ceros, y añado el string formateado al Listbox.
                         ListBox1.Items.Add(String.Join(", ",
                                                        From value As String In comb
                                                        Select If(value.Length = 1I andalso not value.equals("0"),
                                                                  value.Insert(0I, "0"c),
                                                                  value)))
                         ListBox1.Sorted = True



                     End Sub)








luis456

Hola

" Supongo que te refieres a poner "0" y no "00", entonces: "

No me refiero a que no muestre combinaciones que tengan 00 o  0

Luis
Que tu sabiduria no sea motivo de Humillacion para los demas

Eleкtro

¿y entonces que quieres mostrar en su lugar?, no soy adivino, luis.

pero de todas formas creo que eso ya puedes hacerlo tu solito

saludos!