Mostrando las entradas con la etiqueta Array. Mostrar todas las entradas
Mostrando las entradas con la etiqueta Array. Mostrar todas las entradas

jueves, 18 de agosto de 2022

string numbers to array integer

 Dim test() As Integer = str.Split(";").Select(Function(x) CInt(x)).ToArray

lunes, 6 de abril de 2020

Eliminar elementos repetidos array

NombreArray = NombreArray.Distinct.ToArray


miércoles, 29 de enero de 2020

remover elemento de un array por su indice


Dim index_remove As Integer = 3

array = array.Where(Function(x, index) index <> index_remove).ToArray

fuente

jueves, 19 de diciembre de 2019

martes, 27 de agosto de 2019

martes, 13 de agosto de 2019

eliminar registros vacíos (Nothing) en un array

array = array.Where(Function(x) x IsNot Nothing).ToArray


Dim carpeta_xml() As String
carpeta_xml = carpeta_xml.Where(Function(x) Not String.IsNullOrEmpty(x)).ToArray


fuente

fuente1


fuente2

miércoles, 12 de junio de 2019

For each array

For Each c As String In New String() {"1", "2", "3", "4"}
                MessageBox.Show(c)
            Next

jueves, 6 de junio de 2019

ordenar listbox

Dim arr() As Integer = New Integer(lb_dte_activo.Items.Count - 1) {}
            Dim i As Integer = 0

            For Each elem In lb_dte_activo.Items
                arr(i) = elem
                i += 1
            Next
            Array.Sort(arr)
            'lb_dte_activo.Sorted = False
            lb_dte_activo.Items.Clear()
            lb_dte_activo.Items.AddRange(arr.Cast(Of Object).ToArray())

fuente

miércoles, 24 de abril de 2019

'Contains' is not a member of 'System.Array'

'Contains' is not a member of 'System.Array'

error
solución:

agregar  Imports System.Linq

martes, 12 de febrero de 2019

Limpiar array

array= New Byte(array.Length - 1) {}
Array.Clear(array, 0, array.Length)

jueves, 8 de noviembre de 2018

Obtener nombre de la base de datos

Public Function obtener_base_de_datos(ByVal conex As String) As String
        Dim data() As String = conex.Split(";")
        Return Array.Find(data, Function(x) x.ToString.Contains("Catalog")).Split("=")(1).Trim
    End Function

lunes, 29 de octubre de 2018

Array vacío (nada)

If array Is Nothing then
End If

Eliminar registro array

Dim variables() As String ={"a","b"}
Dim eliminar As String = "a"

variables = variables.Where(Function(x) x <> eliminar ).ToArray

fuente

viernes, 27 de abril de 2018

miércoles, 25 de abril de 2018

Buscar elemento dentro de un array

Public Function findStrDB(ByVal strConex() As String) As String
        Return Array.Find(strConex, Function(s) s.ToString.Contains("Initial") OrElse _
                                        s.ToString.Contains("Catalog") OrElse _
                                        s.ToString.Contains("initial") OrElse _
                                        s.ToString.Contains("catalog") OrElse _
                                        s.ToString.Contains("INITIAL") OrElse _
                                        s.ToString.Contains("CATALOG"))
    End Function

jueves, 11 de enero de 2018

Transformar un arreglo a List

Dim ruts() As String
Dim listarut As New List(Of String)

listarut = ruts.ToList()
Dim listarut As New List(Of String)(ruts)

miércoles, 29 de noviembre de 2017

Limpiar un arreglo (array)

Dim readtext() As String = File.ReadAllLines("archivo.txt")
Array.Clear(readtext, 0, readtext.Length)

fuente: https://stackoverflow.com/questions/713867/what-is-the-best-way-to-clear-an-array-of-strings

ReDim readtext(0)

ReDim Preserve

Erase array fuente