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

Laboratorio #4

The document contains code for 4 exercises that demonstrate different ways to use Visual Basic programming for forms and buttons. Exercise 1 converts a number entered into a textbox to the corresponding word (e.g. 5 to "cinco"). Exercise 2 takes a month and year entered as numbers and returns the month name and number of days. Exercise 3 will contain additional code. Exercise 4 counts how many times each number from 1 to 6 is entered and displays the totals.

Uploaded by

cristian
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)
45 views6 pages

Laboratorio #4

The document contains code for 4 exercises that demonstrate different ways to use Visual Basic programming for forms and buttons. Exercise 1 converts a number entered into a textbox to the corresponding word (e.g. 5 to "cinco"). Exercise 2 takes a month and year entered as numbers and returns the month name and number of days. Exercise 3 will contain additional code. Exercise 4 counts how many times each number from 1 to 6 is entered and displays the totals.

Uploaded by

cristian
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

LABORATORIO N° 4

EJERCICIO N°1
Public Class Form1

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


Handles Button1.Click
Dim N, D As Integer
Dim PALABRA As String
N = TextBox1.Text
D = N Mod 10
Select Case D
Case 0 : PALABRA = " CERO "
Case 1 : PALABRA = " UNO "
Case 2 : PALABRA = " DOS "
Case 3 : PALABRA = " TRES "
Case 4 : PALABRA = " CUATRO "
Case 5 : PALABRA = " CINCO "
Case 6 : PALABRA = " SEIS "
Case 7 : PALABRA = " SIETE "
Case 8 : PALABRA = " OCHO "
Case 9 : PALABRA = " NUEVE "
End Select

TextBox2.Text = PALABRA
End Sub

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


Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub

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


Handles Button3.Click
End
End Sub
End Class
EJERCICIO N°2

Public Class Form1

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


System.EventArgs) Handles Button1.Click
Dim MM, AA, CANT_DIAS As Integer
Dim NOMBRE As String
MM = TextBox1.Text
AA = TextBox2.Text

Select Case MM
Case 1 : NOMBRE = "ENERO"
Case 2 : NOMBRE = "FEBRERO"
Case 3 : NOMBRE = "MARZO"
Case 4 : NOMBRE = "ABRIL"
Case 5 : NOMBRE = "MAYO"
Case 6 : NOMBRE = "JUNIO"
Case 7 : NOMBRE = "JULIO"
Case 8 : NOMBRE = "AGOSTO"
Case 9 : NOMBRE = "SETIEMBRE"
Case 10 : NOMBRE = "OCTUBRE"
Case 11 : NOMBRE = "NOVIEMBRE"
Case 12 : NOMBRE = "DICIEMBRE"
Case Else
NOMBRE = "ERROR.. MES INCORRECTO"
End Select
Select Case MM
Case 1, 3, 5, 7, 8, 10, 12 : CANT_DIAS = 31
Case 4, 6, 9, 11 : CANT_DIAS = 30
Case 2 : If AA Mod 4 = 0 Then
CANT_DIAS = 29
Else
CANT_DIAS = 28
End If
End Select
TextBox3.Text = NOMBRE
TextBox4.Text = CANT_DIAS
End Sub

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


System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""

End Sub

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


System.EventArgs) Handles Button3.Click
End

End Sub
End Class
EJERCICIO N°3

EJERCICIO N°4
Public Class Form1
Public C1, C2, C3, C4, C5, C6 As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim NRO As Integer


NRO = TextBox1.Text
ListBox1.Items.Add(NRO)
Select Case NRO
Case 1 : C1 = C1 + 1
Case 2 : C2 = C2 + 1
Case 3 : C3 = C3 + 1
Case 4 : C4 = C4 + 1
Case 5 : C5 = C5 + 1
Case Else
C6 = C6 + 1
End Select
End Sub

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


System.EventArgs) Handles Button2.Click
TextBox2.Text = C1
TextBox3.Text = C2
TextBox4.Text = C3
TextBox5.Text = C4
TextBox6.Text = C5
TextBox7.Text = C6
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 = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
C1 = 0
C2 = 0
C3 = 0
C4 = 0
C5 = 0
C6 = 0
End Sub

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


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

EJERCICIO N°5

EJERCICIO N°6

EJERCICIO N°7
EJERCICIO N°8

You might also like