0% found this document useful (0 votes)
32 views10 pages

Form1: 'Limpiando Listas

The document contains code for multiple exercises that input numbers into arrays, display the arrays, and perform calculations on the array values. It defines arrays to hold integer values, variables to track the array positions and total numbers, and buttons to input values, display arrays, and calculate sums. The code gets more advanced by adding a second array, variables to track the second array, and buttons to input, display, and calculate values across both arrays.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views10 pages

Form1: 'Limpiando Listas

The document contains code for multiple exercises that input numbers into arrays, display the arrays, and perform calculations on the array values. It defines arrays to hold integer values, variables to track the array positions and total numbers, and buttons to input values, display arrays, and calculate sums. The code gets more advanced by adding a second array, variables to track the second array, and buttons to input, display, and calculate values across both arrays.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Public Class Form1

Dim NUM(5) As Integer


Dim numero As Integer
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Activated
txtNum.Focus()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
txtNum.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
'Limpiando listas
ListNum.Items.Clear()
For numero = 0 To 4
ListNum.Items.Add(NUM(numero))
Next
For numero = 0 To 4
NUM(numero) = NUM(numero)
ListBox1.Items.Add("La Posicion " & numero & " es: " & NUM(numero))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
txtNum.Focus()
ListNum.Items.Add(txtNum.Text)
If (numero <= 4) Then
NUM(numero) = Val(txtNum.Text)
numero = numero + 1
txtNum.Text = ""
End If
If (numero >= 5) Then

txtNum.Visible = False
numero = 0
End If
End Sub
End Class

Ejercicio_05
Public Class Form1
Dim NUM(1000000) As Integer
Dim numero, n As Integer
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs)
txtNum.Focus()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
txtNum.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
'Limpiando listas
ListNum.Items.Clear()
For Me.numero = 0 To n - 1
Listnum.Items.Add(NUM(numero))
Next
For Me.numero = 0 To n - 1
NUM(numero) = NUM(numero)
ListBox2.Items.Add("La Posicion " & numero & " es: " & NUM(numero))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim cont As Integer
txtnum.Focus()
Listnum.Items.Add(txtnum.Text)
If cont < n Then
If (numero <= n) Then
NUM(numero) = Val(txtnum.Text)
numero = numero + 1
txtnum.Text = ""
End If
If (numero >= n) Then
txtnum.Visible = False
numero = 0

End If
End If

End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
n = CInt(TextBox1.Text)
End Sub
End Class

Ejercicio_07
Public Class Form1
Dim NUM(1000000) As Integer
Dim numero, n, suma As Integer
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs)
txtNum.Focus()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
txtNum.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
'Limpiando listas
ListNum.Items.Clear()

For Me.numero = 0 To n - 1
Listnum.Items.Add(NUM(numero))
Next
For Me.numero = 0 To n - 1
NUM(numero) = NUM(numero)
ListBox2.Items.Add("La Posicion " & numero & " es: " & NUM(numero))
Next
suma = 0
For Me.numero = 0 To n - 1
suma = suma + NUM(numero)
Next
ListBox2.Items.Add(" ")
ListBox2.Items.Add("la suma es: " & suma)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim cont As Integer
txtnum.Focus()
Listnum.Items.Add(txtnum.Text)
If cont < n Then
If (numero <= n) Then
NUM(numero) = Val(txtnum.Text)
numero = numero + 1
txtnum.Text = ""
End If
If (numero >= n) Then
txtnum.Visible = False
numero = 0
End If
End If

End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
n = CInt(TextBox1.Text)
End Sub
End Class

Ejercicio_04
Public Class Form1
Dim NUM(1000000) As Integer
Dim numero As Integer
Dim n, suma As Integer
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs)
txtNum.Focus()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
txtNum.Focus()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
n = CInt(TextBox1.Text)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim cont As Integer
Dim letra As String
letra = txtnum.Text
txtnum.Focus()
Listnum.Items.Add(letra)
If cont < n Then
If (numero <= n) Then
NUM(numero) = Val(txtnum.Text)
numero = numero + 1
txtnum.Text = ""
End If
If (numero >= n) Then
txtnum.Visible = False
numero = 0
End If
End If
End Sub
End Class

Ejercicio_08
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
'Limpiando listas
ListNum.Items.Clear()

For Me.numero = 0 To n - 1
Listnum.Items.Add(NUM(numero))
Next
For Me.numero = 0 To n - 1
NUM(numero) = NUM(numero)
ListBox2.Items.Add("La Posicion " & numero & " es: " & NUM(numero))
Next
For Me.numero1 = 0 To a - 1
Listnum.Items.Add(NUM(numero1))
Next
For Me.numero1 = 0 To a - 1
NUM(numero1) = NUM(numero1)
ListBox2.Items.Add("La Posicion " & numero1 & " es: " & NUM(numero1))
Next
suma = 0
For Me.numero = 0 To n - 1
suma = suma + NUM(numero)
Next
suma1 = 0
For Me.numero1 = 0 To a - 1
suma1 = suma1 + NUM(numero1)
Next
total = suma + suma1
ListBox2.Items.Add(" ")
ListBox2.Items.Add("la suma del arreglo 1 es : " & suma)
ListBox2.Items.Add("la suma del arreglo 2 es : " & suma1)
ListBox2.Items.Add("el total es : " & total)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim cont As Integer
txtnum.Focus()
Listnum.Items.Add("Arreglo 1 :")
Listnum.Items.Add(txtnum.Text)
If cont < n Then
If (numero <= n) Then

NUM(numero) = Val(txtnum.Text)
numero = numero + 1
txtnum.Text = ""
End If
If (numero >= n) Then
txtnum.Visible = False
numero = 0
End If
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
n = CInt(TextBox1.Text)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button4.Click
a = CInt(TextBox2.Text)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button5.Click
Dim cont As Integer
TextBox3.Focus()
Listnum.Items.Add("Arreglo 2: ")
Listnum.Items.Add(TextBox3.Text)
If cont < a Then
If (numero <= a) Then
NUM(numero1) = Val(TextBox3.Text)
numero1 = numero1 + 1
TextBox3.Text = ""
End If
If (numero1 >= a) Then
TextBox3.Visible = False
numero = 0
End If
End If
End Sub
End Class

You might also like