0% found this document useful (0 votes)
27 views6 pages

Programacion de Computadoras - Laboratorio 6: Form1 Object Eventargs

This document contains the code for 7 problems involving arrays and vectors in Visual Basic. Problem 1 involves inputting numbers into an array and a list box, and finding the largest number. Problem 3 counts the number of occurrences of a number in an array. Problem 5 adds corresponding elements in two arrays and finds the largest sum. Problem 7 checks if a number exists in an array and outputs a message. The code demonstrates basic array manipulation techniques like input, output, searching, and arithmetic operations on elements.
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)
27 views6 pages

Programacion de Computadoras - Laboratorio 6: Form1 Object Eventargs

This document contains the code for 7 problems involving arrays and vectors in Visual Basic. Problem 1 involves inputting numbers into an array and a list box, and finding the largest number. Problem 3 counts the number of occurrences of a number in an array. Problem 5 adds corresponding elements in two arrays and finds the largest sum. Problem 7 checks if a number exists in an array and outputs a message. The code demonstrates basic array manipulation techniques like input, output, searching, and arithmetic operations on elements.
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/ 6

PROGRAMACION DE COMPUTADORAS – LABORATORIO 6

PROBLEMA N°1

Public Class Form1


Public NRO(19), I As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
NRO(I) = TextBox1.Text
ListBox1.Items.Add(NRO(I))
I = I + 1
TextBox1.Text = ""
TextBox1.Focus()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Dim WMAYOR, K, W1 As Integer
K = I - 1
For I = 0 To K
If NRO(I) > WMAYOR Then
WMAYOR = NRO(I)
W1 = I
End If
Next
TextBox2.Text = WMAYOR
TextBox3.Text = W1
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
ListBox1.Items.Clear()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
End
End Sub
End Class

PROBLEMA N°3
Public Class Form1
Public VECT(99), I As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
VECT(I) = TextBox1.Text
ListBox1.Items.Add(VECT(I))
I = I + 1
TextBox1.Clear()
TextBox1.Focus()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Dim NUM, K, X As Integer
NUM = TextBox2.Text
K = I - 1
For I = 0 To K
If VECT(I) = NUM Then
X = X + 1
End If
Next
TextBox3.Text = X

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
ListBox1.Items.Clear()

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
End
End Sub
End Class
PROBLEMA N°5

Public Class Form1


Public A(14), B(14), I As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
A(I) = TextBox1.Text
B(I) = TextBox2.Text
ListBox1.Items.Add(A(I))
ListBox2.Items.Add(B(I))
I = I + 1
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Dim C(14), K, WMAYOR As Integer
K = I - 1
For I = 0 To K
C(I) = A(I) + B(I)
ListBox3.Items.Add(C(I))
If C(I) > WMAYOR Then
WMAYOR = C(I)
End If
Next
TextBox3.Text = WMAYOR
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ListBox3.Items.Clear()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
End
End Sub
End Class

PROBLEMA N°7
Public Class Form1
Public NRO(19), I As Integer

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


System.EventArgs) Handles Button1.Click
NRO(I) = TextBox1.Text
ListBox1.Items.Add(NRO(I))
I = I + 1
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Dim K, NUM, C As Integer
K = I - 1
NUM = TextBox2.Text
For I = 0 To K
If NRO(I) = NUM Then
C = C + 1
End If
Next
If C = 0 Then
TextBox3.Text = "NO SE ENCUENTRA EN EL VECTOR"
Else
TextBox3.Text = "SI SE ENCUENTRA EN EL VECTOR"
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
ListBox1.Items.Clear()

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
End
End Sub
End Class

You might also like