Valla que facilito no ? ¡ solo me faltaban dos meses para hacerlo jejejje
funciona
gracias elektro
Luis
funciona
gracias elektro
Luis
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú Dim combinations As New List(Of Integer()) <---creo esta es la que tiene las combis
Dim length As Integer = 7 <----------esta es la determina las cantidad
Dim skipStart As Integer = 0 <----------NPI
Estos son las formas que me enseñaste
Combos.ForEach(Sub(comb As List(Of Integer))
ListBox1.Items.Add(String.Join(", ", comb))
End Sub)
---------------------------------------------------------------------------
ListBox1.Items.AddRange(
(From comb As List(Of Integer) In Combos
Select String.Join(", ", comb)).ToArray
)
-------------------------------------------------------------------------------------
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)))
End Sub)
combinations.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
Public Class Form1
ReadOnly constantValues As New List(Of Integer) From
{
1I, 9I, 11, 12, 14, 16, 20, 24, 35, 38,
40, 44, 50, 58, 59, 60, 68, 70, 77, 80,
81, 88, 90, 92, 99
}
Private Shadows Sub Load() Handles MyBase.Load
Dim combinations As New List(Of Integer())
Dim length As Integer = 7
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)
ListBox1.Items.AddRange(????????.Cast(Of Object).ToArray) <-----no y no
End Sub
End Class
Cita de: Eleкtro en 11 Octubre 2014, 16:34 PM
¿puedes mostrar como sería el resultado.
Saludos
Public Class Form1
Private Shadows Sub Load() Handles MyBase.Load
Dim sb As New System.Text.StringBuilder
Dim Values As New List(Of Integer()) From
{
({1I, 20, 1I}),
({7I, 22, 4I}),
({8I, 27, 11}),
({20, 29, 17}),
({23, 33, 22}),
({39, 46, 31})
}
For Each ValueCol() As Integer In Values
Dim Value1 As Integer = ValueCol(0)
Dim Value2 As Integer = ValueCol(1)
Dim Value3 As Integer = ValueCol(2)
Dim Diff1 As String = GetDifferenceExpression(Value1, Value2)
Dim Diff2 As String = GetDifferenceExpression(Value2, Value3)
sb.AppendLine(String.Format("{0} -> {1} = {2}",
Value1.ToString("00"), Value2.ToString("00"), Diff1))
sb.AppendLine(String.Format("{0} -> {1} = {2}",
Value2.ToString("00"), Value3.ToString("00"), Diff2))
sb.AppendLine()
Next ValueCol
MessageBox.Show(sb.ToString)
Application.Exit()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim Archivo As System.IO.FileStream
' crea un archivo vacio prueba.txt
Archivo = System.IO.File.Create("c:Documentos\Prueba.txt")
' error
Catch oe As Exception
MsgBox(oe.Message, MsgBoxStyle.Critical)
End Try
End Sub
' Get Difference expression
' ( By Elektro )
'
' Usage Examples:
' MessageBox.Show(GetDifferenceExpression(5, 10))
'
''' <summary>
''' Gets the arithmetic sum/rest difference expression between two values.
''' </summary>
''' <param name="Value1">The first value.</param>
''' <param name="Value2">The second value.</param>
''' <returns>The arithmetic expression.</returns>
Friend Function GetDifferenceExpression(ByVal Value1 As Long, ByVal Value2 As Long) As String
Select Case Value2
Case Is > Value1 ' Value2 is bigger than Value1.
Return String.Format("+{0}", CStr(Value2 - Value1))
Case Is < Value1 ' Value2 is lower than Value1.
Return String.Format("-{0}", CStr(Value1 - Value2))
Case Else ' Value2 is equals to Value1.
Return "0"
End Select
End Function
End Class