Arrays

Páginas: 5 (1190 palabras) Publicado: 17 de mayo de 2010
TEMA 3: ARREGLO TIPO LISTA
Un arreglo tipo lista se define como una variable que permite almacenar un conjunto de datos del mismo tipo organizados en una sola columna y uno o mas renglones.
Tambien reciben el nombre de vectores en algebra o arreglos unidimensionales en programacion.
Los procesos normales con una lista o con sus elementos incluyen declarar toda la lista, capturar sus elementos,desplegarlos, realizar operaciones con ellos, desplegarlos, etc. ar
Para declarar una lista se usa el siguiente formato;
SHARED DIM NOMLISTA(CANT ELEMENTOS -1) AS TIPODATO
Shared(compartido), se usa cuando la lista se tenga que compartir entre varias subutinas, observar que cada boton de comando en un programa empieza con sub-end sub, si un programa tiene varias subrutinas que compartan lamisma lista, dicha lista debera ser SHARED.
La cantidad de elementos-1, significa que si se quiere una lista de 5 ciudades por ejemplo su declaracion sera shared dim ciudad(4) as string, la razon de esto es que visual basic empieza una lista por el elemento o renglon cero(0), por tanto cuando se pide crear una lista de 4 ciudades, visual basic net le agrega el renglon o elemento 0, que en totaldarian 5 ciudade.
Es tambien importante recordar que un arreglo en visual basic net es realmente un objeto derivado de la clase SYSTEM.ARRAY.
Recordar tambien que como objeto arreglo, tambien puede usar una serie de metodos pertenecientes a dicha clase system.array, los metodos principales de dicha clase y por tanto de los arreglos derivados de la misma son:
Public Methods
BinarySearch Overloaded.Searches a one-dimensional sorted Array for a value, using a binary search algorithm.
Clear Sets a range of elements in the Array to zero, to false, or to a null reference (Nothing in Visual Basic), depending on the element type.
Clone Creates a shallow copy of the Array.
Copy Overloaded. Copies a section of one Array to another Array and performs type casting and boxing as required.
CopyToCopies all the elements of the current one-dimensional Array to the specified one-dimensional Array starting at the specified destination Array index.
CreateInstance Overloaded. Initializes a new instance of the Array class.
Equals (inherited from Object) Overloaded. Determines whether two Object instances are equal.
GetEnumerator Returns an IEnumerator for the Array.
GetHashCode (inheritedfrom Object) Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetLength Gets the number of elements in the specified dimension of the Array.
GetLowerBound Gets the lower bound of the specified dimension in the Array.
GetType (inherited from Object) Gets the Type of the current instance.
GetUpperBound Gets the upperbound of the specified dimension in the Array.
GetValue Overloaded. Gets the value of the specified element in the current Array.
IndexOf Overloaded. Returns the index of the first occurrence of a value in a one-dimensional Array or in a portion of the Array.
Initialize Initializes every element of the value-type Array by calling the default constructor of the value type.
LastIndexOf Overloaded.Returns the index of the last occurrence of a value in a one-dimensional Array or in a portion of the Array.
Reverse Overloaded. Reverses the order of the elements in a one-dimensional Array or in a portion of the Array.
SetValue Overloaded. Sets the specified element in the current Array to the specified value.
Sort Overloaded. Sorts the elements in one-dimensional Array objects.
ToString(inherited from Object) Returns a String that represents the current Object.
FUENTE: Ayuda Microsoft Net
notas:
En visual Basic 2005 recordar que la primera posicion o renglon en una lista es la posicion o renglon 0 (cero).
El dato capturado, proviene de momento de un componente escalar textbox y/o se usan tantos de estos controles como elementos tenga el arreglo o mas facil aun se debera...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Arrays
  • Arrays
  • Arrays
  • Arrays
  • Arrays
  • Arrays
  • Los Arrays
  • Arrays

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS