0% found this document useful (0 votes)
40 views

Progra Menu

This document contains code examples in Visual Basic for various numeric calculations and conversions organized into multiple classes, including binary, octal, and hexadecimal conversion; determining the largest of three numbers; corresponding day of the week to a number; calculating factorial and Fibonacci sequences; and a user login validation example. Each class contains buttons to run the calculations, clear fields, and exit.

Uploaded by

Diego Domínguez
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Progra Menu

This document contains code examples in Visual Basic for various numeric calculations and conversions organized into multiple classes, including binary, octal, and hexadecimal conversion; determining the largest of three numbers; corresponding day of the week to a number; calculating factorial and Fibonacci sequences; and a user login validation example. Each class contains buttons to run the calculations, clear fields, and exit.

Uploaded by

Diego Domínguez
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

UNIVERSIDAD POLITCNICA SALESIANA

INGENIERA MECNICA
PROGRAMACIN

NOMBRE: DIEGO DOMINGUEZ


FECHA: 28/01/2016

TEMA: MENU

Public Class USUARIO


Dim X As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
X = X + 1
If (USU.Text = "DIEGO") And (CONT.Text = "1234") Then
Form1.Show()
Else
MsgBox("EL USUARIO O CLAVE SON INCORRECTAS, INGRESE NUEVAMENTE")
If X = 3 Then
MsgBox("..SUPERO EL NUMERO DE INTENTOS..")
End
End If
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
USU.Text = ""
CONT.Text = ""
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles


Button3.Click
End
End Sub
End Class
CAMBIO DE BASE

BINARIO

Public Class Form3


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim X, Y, Z As Integer
X = NUM.Text
While (X >= 2)
Y = X \ 2
Z = X Mod 2
CB.Text = CB.Text & Str(Z)
X = Y
End While
CB.Text = CB.Text & Str(Y)
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
NUM.Text = ""
CB.Text = ""
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles


Button3.Click
End
End Sub
End Class
OCTAL

Public Class Form4


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim X, Y, Z As Integer
X = NUM.Text
While (X >= 8)
Y = X \ 8
Z = X Mod 8
CB.Text = CB.Text & Str(Z)
X = Y
End While
CB.Text = CB.Text & Str(Y)
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
NUM.Text = ""
CB.Text = ""
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles


Button3.Click
End
End Sub
End Class
HEXAGECIMAL

Public Class Form5


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim X As Integer
X = NUM.Text
CB.Text = Hex(X)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
NUM.Text = ""
CB.Text = ""
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
End
End Sub
End Class

DECISIN MULTIPLE

MAYOR ENTRE TRES NUMEROS

Public Class Form6


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
If Val(NUM1.Text) > Val(NUM2.Text) And Val(NUM1.Text) > Val(NUM3.Text)
Then
RES.Text = Val(NUM1.Text)
ElseIf Val(NUM2.Text) > Val(NUM1.Text) And Val(NUM2.Text) >
Val(NUM3.Text) Then
RES.Text = Val(NUM2.Text)
ElseIf Val(NUM3.Text) > Val(NUM2.Text) And Val(NUM3.Text) >
Val(NUM1.Text) Then
RES.Text = Val(NUM3.Text)
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
NUM1.Text = ""
NUM2.Text = ""
NUM3.Text = ""
RES.Text = ""
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles


Button3.Click
End
End Sub
End Class

DIAS DE LA SEMANA

Public Class Form7


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Select Case NUM.Text
Case 1
DIA.Text = "LUNES"
Case 2
DIA.Text = "MARTES"
Case 3
DIA.Text = "MIERCOLES"
Case 4
DIA.Text = "JUEVES"
Case 5
DIA.Text = "VIERNES"
Case 6
DIA.Text = "SABADO"
Case 7
DIA.Text = "DOMINGO"
End Select
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
NUM.Text = ""
DIA.Text = ""
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
End
End Sub
End Class

LAZOS DE REPETICION

FACTORIAL

Public Class Form8


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim X, FAC, j As Integer
X = 1
FAC = 1
While (X <= Val(NUM.Text))
FAC = FAC * X
X = X + 1
End While
RES.Text = FAC
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
NUM.Text = ""
RES.Text = ""
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles


Button3.Click
End
End Sub
End Class
FIBONACCI

Public Class Form9


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim X, Y, Z As Integer
X = 1
Y = 1
RES.Text = (X & " " & Y & " ")
For i = 1 To Val(NUM.Text) - 2
Z = X + Y
X = Y
Y = Z
RES.Text = RES.Text & Z & " "
Next
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
NUM.Text = ""
RES.Text = ""
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
End
End Sub
End Class

You might also like