|
Mostrar Mensajes
|
Páginas: 1 [2] 3 4 5 6 7
|
13
|
Programación / .NET (C#, VB.NET, ASP) / Re: Como puedo saber los números que faltan dentro del rango ?
|
en: 28 Enero 2014, 01:07 am
|
ahora si funciona Public Class Form1 Dim Max As Integer = 99 Dim Xmin As Integer = 0 Dim x As Integer = 0 Dim Número As Double Private TextBoxes As TextBox() = {Nothing} Private Result1 As Int32(), Result2 As Int32(), Result3 As Int32() Private _textBox As Object Private _getNumbersNotInRange As Object Private Property ListBox1Count As Integer 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 Private Property GetNumbersNotInRange(ByVal Result11 As IEnumerable(Of Integer), ByVal Xmin As Integer, ByVal XMax As Integer) As Object Get Return _getNumbersNotInRange End Get Set(ByVal value As Object) _getNumbersNotInRange = value End Set End Property Private Sub Sumar(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Result1 = {Num1 + 10, Num1 + 20, Num1 + 30} _ .Distinct().ToArray ' Elimino duplicados Result2 = {Num2 + 10, Num2 + 20, Num2 + 30} _ .Distinct().ToArray ' Elimino duplicados Result3 = {Num3 + 10, Num3 + 20, Num3 + 30} _ .Distinct().ToArray ' Elimino duplicados ' primero concatenas y eliminas duplicados en el primer array: Dim Result11 As IEnumerable(Of Integer) = (Result1.Concat(Result2).Concat(Result3). Distinct) ' Dim arregloSumas() As Integer = {10, 15, 20, 25, 30} Dim numerosFaltantesdelRango() As Integer = {} Dim rango_min As Integer = 0, rango_max As Integer = 99 Dim tamanio As Integer Dim val As Integer Dim test As Integer For i = rango_min To rango_max val = i If Array.Exists(Result11.Cast(Of Object).ToArray, Function(value As Integer) value = val) = False Then 'Compruebo si el valor de i no aparece en el arreglo de las sumas test += 1 tamanio = UBound(numerosFaltantesdelRango) + 1 ReDim Preserve numerosFaltantesdelRango(tamanio) numerosFaltantesdelRango(tamanio) = val 'Agrego el valor al arreglo End If Next ListBox1.Items.AddRange(numerosFaltantesdelRango.Cast(Of Object).ToArray) End Sub End Class
|
|
|
17
|
Programación / .NET (C#, VB.NET, ASP) / Re: Como puedo saber los números que faltan dentro del rango ?
|
en: 21 Enero 2014, 22:10 pm
|
como aun no estoy muy familiarizado con tu sintaxis lo hare a mi manera (espero se entienda xD) Dim arregloSumas() As Integer = {10, 15, 20, 25, 30} Dim numerosFaltantesdelRango() As Integer = {} Dim rango_min As Integer = 0, rango_max As Integer = 99 Dim tamanio As Integer Dim val As Integer For i = rango_min To rango_max val = i If Array.Exists(arregloSumas, Function(value As Integer) value = val) = False Then 'Compruebo si el valor de i no aparece en el arreglo de las sumas tamanio = numerosFaltantesdelRango.Length + 1 ReDim numerosFaltantesdelRango(tamanio) numerosFaltantesdelRango(tamanio) = val 'Agrego el valor al arreglo End If Next ListBox1.Items.AddRange(numerosFaltantesdelRango.Cast(Of Object).ToArray)
|
|
|
18
|
Programación / .NET (C#, VB.NET, ASP) / como accedo al directorio raiz?
|
en: 21 Enero 2014, 20:08 pm
|
Hola, me gustaria que me dijesen como puedo utilizar el directorio raiz, me refiero al sitio donde esta el programa, que procedimiento debo usar? por si no entienden es que lo necesito para abrir algunos PDF que he puesto en el mismo directorio del exe y quisiera saber cual es su directorio
Saludos
|
|
|
|
|
|
|