programar en visual
DESCRIPTION
Es una revista que contiene ejemplos de programas realizados en visual.netTRANSCRIPT
![Page 1: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/1.jpg)
Y tu…. Qué Programas?
REVISTA:
-Leon Yanez Carlos Andrés
- Cuarto semestre B
Programar en
Visual
![Page 2: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/2.jpg)
![Page 3: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/3.jpg)
1. Enlace de formularios
2. Ejercicios do while tablas de
multiplicar
3. Ejercicio for each netx
4. Ejercicios funciones procedimientos
5. Ejercicio select case validacion de
fecha y 3 mas
6. Ejercicios con cadena de caracteres
7. Ejercicio simulardor web
8. Ejercicio de agenda system io
9. Ejercicio fibonacci
10. Ejercicio factorial
11. Ejercicio cara feliz
12. Ejercicio numero primo
13. Ejercicio cedula validacion
14. Ejercicio ingresar numero y sacar
pares impares
15. Ejercicio bars
16. Ejercicio menu de opciones
17. Ejercicios animacion de texto
18. Ejercicio de contrasena
19. Ejercicio funcion mid len
20. Ejercicio de texto vocales
21. Ejercicio numero par
22. Ejercicio ejercicos con if cartas
23. Ejercicio con timer
24. Ejercicio con if elseif endif
25. Ejercicio de potencia
26. Ejercicos los meses del año
27. Ejercicio numero positivo negativo
28. Ejercicos de vectores 4
29. Redim ejercicios 2
INDICE
![Page 4: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/4.jpg)
PROGRAMA S:
Enlace de Formularios
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form2.Show()
Me.Hide()
End Sub
PROGRAMACIO N
![Page 5: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/5.jpg)
PROGRAMA S:
EDADES
PROGRAMACIO N
![Page 6: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/6.jpg)
PROGRAMA S:
Usuario y Contraseña con Progress Bar
PROGRAMACIO N
![Page 7: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/7.jpg)
PROGRAMA S:
Verificar Cédula - Ecuador
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim prov As Integer
Dim par1, par2, par3, par4, pars As Integer
Dim im1, im2, im3, im4, im5, ims As Integer Dim ced, ced1, ced2, n10, nt As Integer
'Validación Ingreso
nt = Len(TextBox1.Text)
If nt > 10 Or nt < 10 Then MsgBox("CÉDULA INCORRECTA")
TextBox1.Text = ""
TextBox1.Focus()
Else 'provincia
prov = Mid(TextBox1.Text, 1, 2)
'número de validación
n10 = Mid(TextBox1.Text, 10, 1)
PROGRAMACIO N
![Page 8: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/8.jpg)
PROGRAMA S:
Verificar Cédula - Ecuador
par1 = Mid(TextBox1.Text, 2, 1)
par2 = Mid(TextBox1.Text, 4, 1)
par3 = Mid(TextBox1.Text, 6, 1)
par4 = Mid(TextBox1.Text, 8, 1)
'suma
pars = Val(par1) + Val(par2) + Val(par3) + Val(par4) '******************************************
'impares
im1 = Mid(TextBox1.Text, 1, 1) * 2
If im1 > 9 Then im1 = im1 - 9
im2 = Mid(TextBox1.Text, 3, 1) * 2
If im2 > 9 Then im2 = im2 - 9
im3 = Mid(TextBox1.Text, 5, 1) * 2
If im3 > 9 Then im3 = im3 - 9
im4 = Mid(TextBox1.Text, 7, 1) * 2 If im4 > 9 Then im4 = im4 - 9
im5 = Mid(TextBox1.Text, 9, 1) * 2
If im5 > 9 Then im5 = im5 - 9
PROGRAMACIO N
![Page 9: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/9.jpg)
PROGRAMA S:
Verificar Cédula - Ecuador
ims = Val(im1) + Val(im2) + Val(im3) + Val(im4) + Val(im5) '*******************************************
'validacion último número
ced = ims + pars ced1 = Mid(ced, 1, 1) + 1
ced2 = ced1 * 10
ced = ced2 - ced
If ced = n10 Then
MsgBox("Cédula Válida")
PROGRAMACIO N
![Page 10: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/10.jpg)
PROGRAMA S:
Verificar Cédula - Ecuador
If prov = 1 Then TextBox2.Text = " La Provincia es: AZUAY" If prov = 2 Then TextBox2.Text = " La Provincia es: BOLIVAR" If prov = 3 Then TextBox2.Text = " La Provincia es: CAÑAR" If prov = 4 Then TextBox2.Text = " La Provincia es: CARCHI" If prov = 4 Then TextBox2.Text = " La Provincia es: CARCHI" If prov = 5 Then TextBox2.Text = " La Provincia es: COTOPAXI" If prov = 6 Then TextBox2.Text = " La Provincia es: CHIMBORAZO" If prov = 7 Then TextBox2.Text = " La Provincia es: EL ORO" If prov = 8 Then TextBox2.Text = " La Provincia es: ESMERALDAS" If prov = 9 Then TextBox2.Text = " La Provincia es: GUAYAS" If prov = 10 Then TextBox2.Text = " La Provincia es: IMBABURA" If prov = 11 Then TextBox2.Text = " La Provincia es: LOJA" If prov = 12 Then TextBox2.Text = " La Provincia es: LOS RIOS" If prov = 13 Then TextBox2.Text = " La Provincia es: MANABÍ" If prov = 14 Then TextBox2.Text = " La Provincia es: MORONA SANTIAGO"
If prov = 15 Then TextBox2.Text = " La Provincia es: NAPO" If prov = 16 Then TextBox2.Text = " La Provincia es: PASTAZA" If prov = 17 Then TextBox2.Text = " La Provincia es: PICHINCHA" If prov = 18 Then TextBox2.Text = " La Provincia es: TUNGURAHUA" If prov = 19 Then TextBox2.Text = " La Provincia es: ZAMORA CHINCHIPE" If prov = 20 Then TextBox2.Text = " La Provincia es: GALAPAGOS" If prov = 21 Then TextBox2.Text = " La Provincia es: SUCUMBIOS" If prov = 22 Then TextBox2.Text = " La Provincia es: ORELLANA" If prov = 23 Then TextBox2.Text = " La Provincia es: Santo Domingo de los Tsachilas" If prov = 24 Then TextBox2.Text = " La Provincia es: SANTA ELENA" Else MsgBox("Cédula no Valida") TextBox1.Text = "" TextBox1.Focus() End If End If End Sub End Class
PROGRAMACIO N
![Page 11: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/11.jpg)
PROGRAMA S:
Tablas de Multiplicar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim X, R, T, A, B, C, D, F, G, H, I, J, L As Integer
While X < 10
X = X + 1
R = X * 1
ListBox1.Items.Add(R & "=" & X.ToString & " X " & "1")
T = T + 1
R = T * 2
ListBox2.Items.Add(R & "=" & T.ToString & " X " & "2")
A = A + 1
R = A * 3
ListBox3.Items.Add(R & "=" & A.ToString & " X " & "3")
B = B + 1
R = B * 4
PROGRAMACIO N
![Page 12: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/12.jpg)
PROGRAMA S:
Tablas de Multiplicar
B = B + 1
R = B * 4
ListBox4.Items.Add(R & "=" & B.ToString & " X " & "4")
C = C + 1
R = C * 5
ListBox5.Items.Add(R & "=" & C.ToString & " X " & "5")
D = D + 1
R = D * 6
ListBox6.Items.Add(R & "=" & D.ToString & " X " & "6")
F = F + 1
R = F * 7
ListBox7.Items.Add(R & "=" & F.ToString & " X " & "7")
PROGRAMACIO N
![Page 13: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/13.jpg)
PROGRAMA S:
Tablas de Multiplicar
R = G * 8
ListBox8.Items.Add(R & "=" & G.ToString & " X " & "8")
H = H + 1
R = H * 9
ListBox9.Items.Add(R & "=" & H.ToString & " X " & "9")
L = L + 1
R = H * 12
ListBox12.Items.Add(R & "=" & L.ToString & " X " & "12")
End While
End Sub
PROGRAMACIO N
![Page 14: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/14.jpg)
PROGRAMA S:
For Each
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
For Each dato As Control In Me.Controls 'sirve para todos los objetos
del formulario
'If dato.GetType.ToString.Contains("Label") Then
'pinta todos los labels
If dato.GetType.ToString.Contains("Button") Then
'pinta todos los butons
dato.BackColor = Color.Aqua
End If
Next
End Sub
PROGRAMACIO N
![Page 15: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/15.jpg)
PROGRAMA S:
Funciones y Procedimientos
Public Function suma() As Integer Return Val(TextBox1.Text) + Val
(TextBox2.Text)
End Function
Public Sub limpiar()
TextBox1.Text = ""
TextBox2.Text = ""
Label2.Text = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label2.Text = suma()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
limpiar()
End Sub
PROGRAMACIO N
![Page 16: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/16.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim A As Integer
A = TextBox1.Text
Select Case A
Case 1
TextBox2.Text = "LUNES"
Case 2
TextBox2.Text = "MARTES"
Case 3
TextBox2.Text = "MIERCOLES"
Case 4
TextBox2.Text = "JUEVES"
Case 5
PROGRAMACIO N
![Page 17: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/17.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
TextBox2.Text = "VIERNES"
Case 6
TextBox2.Text = "SABADO"
Case 7
TextBox2.Text = "DOMINGO"
End Select
End Sub
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Form3.Show()
Me.Hide()
PROGRAMACIO N
![Page 18: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/18.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Select Case ComboBox1.SelectedIndex
Case 0
TextBox1.Text = 1
Case 1
TextBox1.Text = 2
Case 2
TextBox1.Text = 3
Case 3
TextBox1.Text = 4
Case 4
TextBox1.Text = 5
Case 5
PROGRAMACIO N
![Page 19: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/19.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Case 6
TextBox1.Text = 7
End Select
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form4.Show()
Me.Hide()
End Sub
PROGRAMACIO N
![Page 20: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/20.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Dim A As Integer = 0
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If A = 7 Then
A = 0
Else
A = A + 1
Select Case A
PROGRAMACIO N
![Page 21: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/21.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Case 1
Label1.Visible = True
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Label2.Visible = False
Label7.Visible = False
Case 2
Label1.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Label2.Visible = True
PROGRAMACIO N
![Page 22: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/22.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Case 3
Label1.Visible = False
Label3.Visible = True
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Label2.Visible = False
Label7.Visible = False
Case 4
Label1.Visible = False
Label3.Visible = False
Label4.Visible = True
Label5.Visible = False
Label6.Visible = False
Label2.Visible = False
PROGRAMACIO N
![Page 23: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/23.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Case 5
Label1.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = True
Label6.Visible = False
Label2.Visible = False
Label7.Visible = False
Case 6
Label1.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = True
Label2.Visible = False
PROGRAMACIO N
![Page 24: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/24.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Case 7
Label1.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Label2.Visible = False
Label7.Visible = True
End Select
End If
End Sub
PROGRAMACIO N
![Page 25: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/25.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Dim COUNT As Integer = 0
Public Sub ANIMAR()
If COUNT = 3 Then
COUNT = 0
Else
COUNT = COUNT + 1
Select Case COUNT
Case 1
Form1.PictureBox1.Visible = True
Form1.PictureBox2.Visible = False
Form1.PictureBox3.Visible = False
Form2.PictureBox1.Visible = True
Form2.PictureBox2.Visible = False
Form2.PictureBox3.Visible = False
PROGRAMACIO N
![Page 26: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/26.jpg)
PROGRAMA S:
Ejercicio select case validación de fecha y 3 mas
Case 2
Form1.PictureBox1.Visible = False
Form1.PictureBox2.Visible = True
Form1.PictureBox3.Visible = False
Form2.PictureBox1.Visible = False
Form2.PictureBox2.Visible = True
Form2.PictureBox3.Visible = False
Case 3
Form1.PictureBox1.Visible = False
Form1.PictureBox2.Visible = False
Form1.PictureBox3.Visible = True
Form2.PictureBox1.Visible = False
Form2.PictureBox2.Visible = False
Form2.PictureBox3.Visible = True
End Select
End If
End Sub
PROGRAMACIO N
![Page 27: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/27.jpg)
PROGRAMA S:
Manipular caracteres con MID
PROGRAMACIO N
![Page 28: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/28.jpg)
PROGRAMA S:
Manipular caracteres con LED
PROGRAMACIO N
![Page 29: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/29.jpg)
PROGRAMA S:
Manipular caracteres con LED
PROGRAMACIO N
![Page 30: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/30.jpg)
PROGRAMA S:
Manipular caracteres con RIGHT
PROGRAMACIO N
![Page 31: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/31.jpg)
PROGRAMA S:
Manipular caracteres con SPACE
PROGRAMACIO N
![Page 32: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/32.jpg)
PROGRAMA S:
Manipular caracteres con TRIM
PROGRAMACIO N
![Page 33: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/33.jpg)
PROGRAMA S:
Convertir Caracteres
PROGRAMACIO N
![Page 34: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/34.jpg)
PROGRAMA S:
Ejercicio de agenda system io
PROGRAMACIO N
![Page 35: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/35.jpg)
PROGRAMA S:
Ejercicio fibonacci
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim N, f1, f2, s As Integer
N = Val(TextBox1.Text)
f1 = 0
f2 = 1
For I = 1 To N Step 1
f1 = f2
f2 = s
TextBox2.Text = TextBox2.Text & " " & s
ListBox1.Items.Add(TextBox2.Text)
s = f1 + f2
Next
End Sub
PROGRAMACIO N
![Page 36: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/36.jpg)
PROGRAMA S:
Ejercicio fibonacci
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim N, primo As Double
N = Val(TextBox1.Text)
For i = 1 To N Step 1
If N Mod i = 0 Then
primo += 1
End If
Next
If primo = 2 Then
MsgBox(N & " es Primo")
TextBox1.Text = ""
TextBox1.Focus()
PROGRAMACIO N
![Page 37: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/37.jpg)
PROGRAMA S:
Ejercicio fibonacci
Else
MsgBox(N & " No es Primo")
TextBox1.Text = ""
TextBox1.Focus()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End Sub
End Class
PROGRAMACIO N
![Page 38: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/38.jpg)
PROGRAMA S:
Ejercicio simulardor web
Public Class Navegador
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
WebBrowser1.GoBack()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
WebBrowser1.Refresh()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
WebBrowser1.GoForward()
End Sub
PROGRAMACIO N
![Page 39: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/39.jpg)
PROGRAMA S:
Ejercicio simulardor web
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
End Class
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
End Class
PROGRAMACIO N
![Page 40: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/40.jpg)
PROGRAMA S:
Ejercicio cara feliz
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim num1, num2 As Integer
num1 = Int((Rnd()) * 10)
num2 = Int((Rnd()) * 10)
TextBox1.Text = num1
TextBox2.Text = num2
PictureBox1.Image = Nothing
TextBox3.Text = ""
TextBox3.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If Val(TextBox3.Text) = Val(TextBox1.Text) + Val(TextBox2.Text)
Then
PROGRAMACIO N
![Page 41: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/41.jpg)
PROGRAMA S:
Ejercicio cara feliz
Else
PictureBox1.Image = triste.Image
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub
End Class
PROGRAMACIO N
![Page 42: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/42.jpg)
PROGRAMA S:
Ejercicios con imágenes
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
feliz1.Visible = True
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button8.Click
feliz2.Visible = True
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
triste1.Visible = True
End Sub
PROGRAMACIO N
![Page 43: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/43.jpg)
PROGRAMA S:
Ejercicios con imágenes
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
triste2.Visible = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
rosa1.Visible = True
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
rosa2.Visible = True
End Sub
PROGRAMACIO N
![Page 44: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/44.jpg)
PROGRAMA S:
Ejercicios con imágenes
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If feliz1.Visible = True And feliz2.Visible = True Then
feliz1.Visible = True
Else
feliz1.Visible = False
End If
End Sub
Private Sub Timer8_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer8.Tick
If feliz2.Visible = True And feliz1.Visible = True Then
feliz2.Visible = True
Else
feliz2.Visible = False
PROGRAMACIO N
![Page 45: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/45.jpg)
PROGRAMA S:
Ejercicios con imágenes
Else
feliz2.Visible = False
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
love1.Visible = True
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button7.Click
love2.Visible = True
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As
PROGRAMACIO N
![Page 46: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/46.jpg)
PROGRAMA S:
Ejercicios con imágenes
If rosa1.Visible = True And rosa2.Visible = True Then
rosa1.Visible = True
Else
rosa1.Visible = False
End If
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer4.Tick
If rosa2.Visible = True And rosa1.Visible = True Then
rosa2.Visible = True
Else
rosa2.Visible = False
End If
End Sub
PROGRAMACIO N
![Page 47: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/47.jpg)
PROGRAMA S:
Ejercicios con imágenes
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer3.Tick
If triste1.Visible = True And triste2.Visible = True Then
triste1.Visible = True
Else
triste1.Visible = False
End If
End Sub
Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer6.Tick
If triste2.Visible = True And feliz1.Visible = True Then
triste2.Visible = True
Else
triste2.Visible = False
End If
PROGRAMACIO N
![Page 48: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/48.jpg)
PROGRAMA S:
Ejercicios con imágenes
Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer5.Tick
If love1.Visible = True And love2.Visible = True Then
love1.Visible = True
Else
love1.Visible = False
End If
End Sub
Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer7.Tick
If love2.Visible = True And love1.Visible = True Then
love2.Visible = True
Else
love2.Visible = False
End If
PROGRAMACIO N
![Page 49: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/49.jpg)
PROGRAMA S:
Ejercicios con imágenes
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button9.Click
feliz1.Visible = False
feliz2.Visible = False
triste1.Visible = False
triste2.Visible = False
rosa1.Visible = False
rosa2.Visible = False
love1.Visible = False
love2.Visible = False
End Sub
End Class
PROGRAMACIO N
![Page 50: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/50.jpg)
PROGRAMA S:
Utilizando un Módulo
PROGRAMACIO N
![Page 51: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/51.jpg)
PROGRAMA S:
Utilizando un Módulo
PROGRAMACIO N
![Page 52: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/52.jpg)
PROGRAMA S:
Utilizando un Módulo
PROGRAMACIO N
![Page 53: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/53.jpg)
PROGRAMA S:
Utilizando un Módulo
PROGRAMACIO N
![Page 54: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/54.jpg)
PROGRAMA S:
Utilizando un Módulo
PROGRAMACIO N
![Page 55: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/55.jpg)
PROGRAMA S:
Utilizando un Módulo
PROGRAMACIO N
![Page 56: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/56.jpg)
PROGRAMA S:
Operadores Aritmeticos
PROGRAMACIO N
![Page 57: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/57.jpg)
PROGRAMA S:
Ejercicio de texto vocales
Public contador As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
contador = 0
For i = 1 To Len(TextBox1.Text)
If Mid(TextBox1.Text, i, 1) = "a" Or Mid(TextBox1.Text, i, 1) =
"A" Then
contador = contador + 1
End If
Next
TextBox2.Text = contador
End Sub
PROGRAMACIO N
![Page 58: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/58.jpg)
PROGRAMA S:
Ejercicio de texto vocales
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
contador = 0
For i = 1 To Len(TextBox1.Text)
If Mid(TextBox1.Text, i, 1) = "e" Or Mid(TextBox1.Text, i, 1) =
"E" Then
contador = contador + 1
End If
Next
TextBox3.Text = contador
End Su
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
contador = 0
"
PROGRAMACIO N
![Page 59: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/59.jpg)
PROGRAMA S:
Ejercicio de texto vocales
If Mid(TextBox1.Text, i, 1) = "i" Or Mid(TextBox1.Text, i, 1) =
"I" Then
contador = contador + 1
End If
Next
TextBox4.Text = contador
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
contador = 0
For i = 1 To Len(TextBox1.Text)
If Mid(TextBox1.Text, i, 1) = "o" Or Mid(TextBox1.Text, i, 1) =
"O" Then
contador = contador + 1
End If
Next
PROGRAMACIO N
![Page 60: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/60.jpg)
PROGRAMA S:
Ejercicio de texto vocales
TextBox5.Text = contador
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
contador = 0
For i = 1 To Len(TextBox1.Text)
If Mid(TextBox1.Text, i, 1) = "u" Or Mid(TextBox1.Text, i, 1) =
"U" Then
contador = contador + 1
End If
Next
TextBox6.Text = contador
End Sub
PROGRAMACIO N
![Page 61: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/61.jpg)
PROGRAMA S:
Ejercicio de texto vocales
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button7.Click
End
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox1.Focus()
End Sub
PROGRAMACIO N
![Page 62: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/62.jpg)
PROGRAMA S:
Ejercicio numero par
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a As Integer
Dim par, impar As Integer
For I = 1 To 5 Step 1
a = InputBox("Ingrese el número: ")
If a Mod 2 = 0 Then
par = par + 1
Else
impar = impar + 1
End If
Next
MsgBox(" LOS NÚMEROS SON:" & Chr(13) & Chr(13) & "Números
Pares= " & par & Chr(13) & "Números Impares= " & impar & Chr(13) & Chr(13) &
" Click en Aceptar para continuar")
End Sub
PROGRAMACIO N
![Page 63: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/63.jpg)
PROGRAMA S:
Ejercicio ejercicos con if cartas
Public N, N1, N2, N3, N4, N5, N6 As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
N = N1 + N2 + N3 + N4 + N5 + N6
Label1.Text = N
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
N1 = 8
Else
N1 = 0
End If
End Sub
PROGRAMACIO N
![Page 64: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/64.jpg)
PROGRAMA S:
Ejercicio ejercicos con if cartas
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
N2 = 4
Else
N2 = 0
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles CheckBox3.CheckedChanged
If CheckBox3.Checked = True Then
N3 = 32
Else
N3 = 0
End If
End Sub
PROGRAMACIO N
![Page 65: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/65.jpg)
PROGRAMA S:
Ejercicio ejercicos con if cartas
Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox4.CheckedChanged
If CheckBox4.Checked = True Then
N4 = 1
Else
N4 = 0
End If
End Sub
Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles CheckBox5.CheckedChanged
If CheckBox5.Checked = True Then
N5 = 16
Else
N5 = 0
End If
End Sub
PROGRAMACIO N
![Page 66: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/66.jpg)
PROGRAMA S:
Ejercicio ejercicos con if cartas
Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox6.CheckedChanged
If CheckBox6.Checked = True Then
N6 = 2
Else
N6 = 0
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End Sub
PROGRAMACIO N
![Page 67: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/67.jpg)
PROGRAMA S:
Ejercicio ejercicos con if cartas
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
CheckBox1.Checked = False
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
CheckBox6.Checked = False
Label1.Text = ""
End Sub
PROGRAMACIO N
![Page 68: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/68.jpg)
PROGRAMA S:
Usuario y Contraseña
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Usuario As String
Dim contraseña As String
Usuario = "Nombre"
contraseña = "123"
If TextBox1.Text = Usuario And TextBox2.Text = contraseña Then
Timer1.Start()
Else
MsgBox("El nombre de usuario o contraseña es incorrecto.")
TextBox1.Text = ""
TextBox2.Text = ""
End If
End Sub
PROGRAMACIO N
![Page 69: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/69.jpg)
PROGRAMA S:
Ejercicio con if elseif endif
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim N1 As Double
N1 = TextBox1.Text
If N1 = 0 Then
MsgBox("Ingresaste 0, prueba un nuevo número")
TextBox1.Text = ""
TextBox1.Focus()
ElseIf N1 > 0 Then
TextBox2.Text = "POSITIVO"
Else
TextBox2.Text = "NEGATIVO"
End If
End Sub
PROGRAMACIO N
![Page 70: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/70.jpg)
PROGRAMA S:
Ejercicio con if elseif endif
Dim public s, sf, a, au As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click a = TextBox2.Text
If a >= 10 Then
au = s * 0.1
ElseIf a > 5 Then
au = s * 0.07
ElseIf a > 3 Then
au = s * 0.05
Else : au = s * 0.03
End If
TextBox5.Text = au
sf = s + au
TextBox3.Text = sf
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load s = 40000 / 12
TextBox4.Text = s
End Sub
PROGRAMACIO N
![Page 71: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/71.jpg)
PROGRAMA S:
Ejercicos de vectores 4
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim A(5) As Integer Dim N As Integer For I = 0 To 4 N = InputBox("Ingrese vector: " & I + 1) ListBox1.Items.Add(N) Next End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged End Sub End Class
PROGRAMACIO N
![Page 72: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/72.jpg)
PROGRAMA S:
Ejercicos de vectores 4
Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim TEXT As TextBox() = New TextBox() {TextBox1, TextBox2, TextBox3, TextBox4, TextBox5} For I = 0 To 4 TEXT(I).Text = InputBox("Ingrese vector:" & I) Next End Sub End Class
PROGRAMACIO N
![Page 73: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/73.jpg)
PROGRAMA S:
Ejercicos de vectores 4
Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim N As Integer Dim N1 As Integer N = TextBox1.Text For I = 1 To N N1 = InputBox("Ingrese vector: " & I) ListBox1.Items.Add(N1) Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim A As Integer Dim B As Integer Dim C As Integer Dim I As Integer For I = 1 To Val(ListBox1) Step 1 'A = Val(Mid(ListBox1, I, 1)) If A Mod 2 = 0 Then B = B + AE lse C = C + A End If TextBox2.Text = B TextBox3.Text = C Next
PROGRAMACIO N
End Sub End Class
![Page 74: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/74.jpg)
PROGRAMA S:
Ejercicos de vectores 4
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim A(4) As Integer For I = 1 To 4 A(I) = I * 5 ListBox1.Items.Add(A(I)) Next ReDim Preserve A(7) For I = 4 To 7 A(I) = I * 10 Next For I = 1 To 7 ListBox2.Items.Add(A(I)) Next End Sub End Sub End Class
PROGRAMACIO N
![Page 75: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/75.jpg)
PROGRAMA S:
Ejercicos de vectores 4
Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim A(4) As Integer For I = 1 To 4 A(I) = InputBox("Ingrese vector: " & I) ListBox1.Items.Add(A(I)) Next ReDim Preserve A(7) For I = 4 To 7 A(I) = InputBox("Ingrese vector: " & I) Next For I = 1 To 7 ListBox2.Items.Add(A(I)) Next End Sub End Class
PROGRAMACIO N
![Page 76: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/76.jpg)
PROGRAMA S:
Ejercicos de vectores 4
Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim N1, N2, N3 As Integer N1 = InputBox("Ingrese cuántos vectores") Dim VEC(N1) As Integer For I = 1 To N1 VEC(I) = InputBox("Ingrese los vectores") ListBox1.Items.Add(VEC(I)) Next N2 = InputBox("Ingrese redimensión del vector") N3 = N1 + N2 ReDim Preserve VEC(N3) For I = N1 + 1 To N3 VEC(I) = InputBox("Números de vectores a redimensionar") Next For I = 1 To N3 ListBox2.Items.Add(VEC(I)) Next End Sub
PROGRAMACIO N
![Page 77: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/77.jpg)
PROGRAMA S:
Matrices
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim mat1(3, 3) As Integer For I = 1 To 3 For J = 1 To 3 mat1(I, J) = InputBox("Ingrese los valores de la matriz") ListBox1.Items.Add(mat1(I, J)) Next Next End Sub End Class
PROGRAMACIO N
![Page 78: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/78.jpg)
PROGRAMA S:
Matrices
Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim mat1(2, 3) As Integer For I = 1 To 2 For J = 1 To 3 mat1(I, J) = InputBox("Ingrese los valores de la matriz") ListBox1.Items.Add(mat1(I, J)) Next Next Dim mat2(3, 2) As Integer For K = 1 To 3 For L = 1 To 2 mat2(K, L) = InputBox("Ingrese los valores de la matriz") ListBox2.Items.Add(mat2(K, L)) Next Next End Sub End Sub End Class
PROGRAMACIO N
![Page 79: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/79.jpg)
PROGRAMA S:
Matrices
Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim mat1(2, 3) As Integer For I = 1 To 2 For J = 1 To 3 mat1(I, J) = InputBox("Ingrese los valores de la matriz") ListBox1.Items.Add(mat1(I, J)) Next Next Dim mat2(3, 2) As Integer For K = 1 To 3 For L = 1 To 2 mat2(K, L) = InputBox("Ingrese los valores de la matriz") ListBox2.Items.Add(mat2(K, L)) Next Next Dim mat3(2, 2) As Integer Dim ACUM As Integer For M = 1 To 2 For N = 1 To 2 For P = 1 To 3 ACUM = mat1(M, P) * mat2(P, N) + ACUM Next mat3(M, N) = ACUM ListBox3.Items.Add(mat3(M, N)) ACUM = 0 Next Next
End Sub
PROGRAMACIO N
![Page 80: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/80.jpg)
PROGRAMA S:
Suma Y Resta de Matrices
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim F1 As Integer Dim C1 As Integer Dim F2 As Integer Dim C2 As Integer F1 = InputBox("Ingrese el número de filas de la primera matriz") C1 = InputBox("Ingrese el número de columnas de la primera matriz") F2 = InputBox("Ingrese el número de filas de la segunda matriz") C2 = InputBox("Ingrese el número de columnas de la segunda matriz") If C1 = C2 And F1 = F2 Then Dim mat1(F1, C1) As Integer For I = 1 To F1 For J = 1 To C1 mat1(I, J) = InputBox("Ingrese los valores de la matriz") ListBox1.Items.Add(mat1(I, J)) Next Next Dim mat2(F2, C2) As Integer For K = 1 To F2 For L = 1 To C2 mat2(K, L) = InputBox("Ingrese los valores de la matriz") ListBox2.Items.Add(mat2(K, L)) Next Next Dim mat3(F1, F2) As Integer Dim ACUM As Integer For M = 1 To F1 For N = 1 To F2 For P = 1 To C2 ACUM = mat1(M, N) + mat2(M, N) Next
PROGRAMACIO N
![Page 81: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/81.jpg)
PROGRAMA S:
Suma Y Resta de Matrices
mat3(M, N) = ACUM ListBox3.Items.Add(mat3(M, N)) ACUM = 0 Next Next Else MsgBox("ERROR") End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim F1 As Integer Dim C1 As Integer Dim F2 As Integer Dim C2 As Integer F1 = InputBox("Ingrese el número de filas de la primera matriz") C1 = InputBox("Ingrese el número de columnas de la primera matriz") F2 = InputBox("Ingrese el número de filas de la segunda matriz") C2 = InputBox("Ingrese el número de columnas de la segunda matriz") If C1 = C2 And F1 = F2 Then Dim mat1(F1, C1) As Integer For I = 1 To F1 For J = 1 To C1 mat1(I, J) = InputBox("Ingrese los valores de la matriz") ListBox1.Items.Add(mat1(I, J)) Next Next Dim mat2(F2, C2) As Integer For K = 1 To F2 For L = 1 To C2 mat2(K, L) = InputBox("Ingrese los valores de la matriz") ListBox2.Items.Add(mat2(K, L))
PROGRAMACIO N
![Page 82: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/82.jpg)
PROGRAMA S:
Suma Y Resta de Matrices
Dim mat2(F2, C2) As Integer For K = 1 To F2 For L = 1 To C2 mat2(K, L) = InputBox("Ingrese los valores de la matriz") ListBox2.Items.Add(mat2(K, L)) Next Next Dim mat3(F1, F2) As Integer Dim ACUM As Integer For M = 1 To F1 For N = 1 To F2 For P = 1 To C2 ACUM = mat1(M, N) - mat2(M, N) Next mat3(M, N) = ACUM ListBox3.Items.Add(mat3(M, N)) ACUM = 0 Next Next Else MsgBox("ERROR") End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ListBox1.Items.Clear() ListBox2.Items.Clear() ListBox3.Items.Clear() End Sub End Class Next Next
PROGRAMACIO N
![Page 83: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/83.jpg)
PROGRAMA S:
Suma Y Resta de Vectores
Public Class Form2 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ListBox1.Items.Clear() ListBox2.Items.Clear() ListBox3.Items.Clear() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim C1 As Integer Dim C2 As Integer C1 = InputBox("Ingrese el número de filas del primer vector") C2 = InputBox("Ingrese el número de filas del segundo vector") If C1 = C2 Then Dim mat1(C1) As Integer For I = 1 To C1 mat1(I) = InputBox("Ingrese los valores de los vectores") ListBox1.Items.Add(mat1(I)) Next Dim mat2(C2) As Integer For K = 1 To C2 mat2(K) = InputBox("Ingrese los valores de los vectores") ListBox2.Items.Add(mat2(K)) Next
PROGRAMACIO N
![Page 84: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/84.jpg)
PROGRAMA S:
Suma Y Resta de Vectores
Dim mat3(C1) As Integer Dim ACUM As Integer For M = 1 To C1 ACUM = mat1(M) + mat2(M) mat3(M) = ACUM ListBox3.Items.Add(mat3(M)) ACUM = 0 Next Else MsgBox("ERROR") End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim C1 As Integer Dim C2 As Integer C1 = InputBox("Ingrese el número de filas del primer vector") C2 = InputBox("Ingrese el número de filas del segundo vector")
PROGRAMACIO N
![Page 85: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/85.jpg)
PROGRAMA S:
Suma Y Resta de Vectores
If C1 = C2 Then Dim mat1(C1) As Integer For I = 1 To C1 mat1(I) = InputBox("Ingrese los valores del vector") ListBox1.Items.Add(mat1(I)) Next Dim mat2(C2) As Integer For K = 1 To C2 mat2(K) = InputBox("Ingrese los valores del vector") ListBox2.Items.Add(mat2(K)) Next Dim mat3(C1) As Integer Dim ACUM As Integer For M = 1 To C1 ACUM = mat1(M) - mat2(M) mat3(M) = ACUM ListBox3.Items.Add(mat3(M)) ACUM = 0 Next Else MsgBox("ERROR") End If End Sub End Class
PROGRAMACIO N
![Page 86: Programar en Visual](https://reader030.vdocuments.site/reader030/viewer/2022020112/568c55c31a28ab4916c40c91/html5/thumbnails/86.jpg)