PROGRAMAS EN VISUAL BASIC 2010.NET

Page 1

UNIVERSIDAD CENTRAL DEL ECUADOR FACULTAD DE FILOSOFIA LETRAS Y CIENCIAS DE LA EDUCACIÓN ESCUELA DE CIENCIAS EXACTAS. CARRERA INFORMATICA TITULO: REVISTA DE PROGRAMAS REALIZADOS EN LENGUAJE VISUAL BASIC 2010

ASIGNATURA: PROGRAMACION IV

MSc. ZAPATA VICTOR

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR

INTRODUCCION

La gama de productos de Visual Studio comparte un único entorno de desarrollo integrado (IDE) que se compone de varios elementos: la barra de menús, la barra de herramientas Estándar, varias ventanas de herramientas que se acoplan u ocultan automáticamente a la izquierda, en la parte inferior y a la derecha, así como en el espacio del editor. Las ventanas de herramientas, menús y barras de herramientas disponibles dependen del tipo de proyecto o archivo en el que esté trabajando. La gran mayoría de programadores de VB.NET utilizan el entorno de desarrollo integrado Microsoft Visual Studio en alguna de sus versiones (desde el primer Visual Studio .NET hasta Visual Studio .NET 2012, que es la última versión de Visual Studio para la plataforma .NET), aunque existen otras alternativas, como SharpDevelop (que además es libre). Al igual que con todos los lenguajes de programación basados en .NET, los programas escritos en VB .NET requieren el Framework .NET o Mono para ejecutarse.

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR INSTALACION DE VISUAL BASIC 2010 Instalar mediante los discos de instalación Para instalar Visual Studio, ejecute primer Setup.exe, que se encuentra en el directorio raíz de los discos de instalación de Visual Studio. Se iniciará el asistente para la instalación d Microsoft Visual Studio 2010 (versión de evaluación). Pulsaremos en "Instalar Microsoft Visual Studio 2010": Seguir los pasos indicados en la instalación.

Tras el proceso de instalación puede que pida reiniciar el equipo:

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR

Una vez instalado el programa ya se puede seguir utilizando este:

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR

PROGRAMAS REALIZADOS EN EL SEMESTRE PROGRAMA QUE ME PERMITA INGRESAR EL NUMBRE DE EL USUARIO Y QUE ME INDIQUE EN LA PANTALLA FORMULARIO

CODIGO FUENTE PublicClass Form1 Dim NOM AsString PrivateSub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) EndSub PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click NOM = InputBox("INGRESE EL NOMBRE") TextBox1.Text = NOM MsgBox("BIENVENIDO"& NOM) EndSub PrivateSub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR EndSub EndClass

REALIZAR UN PROGRAMA QUE PERMITA REALIZAR LA SUMA DE DOS NUMEROS INGRESADOS FORMULARIO

CODIGO FUENTE PublicClass Form1 PrivateSub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click EndSub PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End EndSub PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim RESULTADO AsDouble RESULTADO = CDbl(TextBox1.Text) + CDbl(TextBox2.Text) TextBox3.Text = RESULTADO MsgBox("LA RESPUESTA ES CORRECTA") EndSub EndClass

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR

REALIZAR UN PROGRAMA QUE PERMITA REALIZAR LA SUMA, RESTA, MULTIPLICACION Y DIVISION DE DOS NUMEROS INGRESADO

FORMULARIO

CODIGO FUENTE PublicClass Form1 PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox3.Text = Val(TextBox1.Text * TextBox2.Text) EndSub PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox3.Text = Val(TextBox1.Text + TextBox2.Text) EndSub PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox3.Text = Val(TextBox1.Text - TextBox2.Text) EndSub

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PrivateSub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox3.Text = Val(TextBox1.Text / TextBox2.Text) EndSub PrivateSub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.TextBox1.Text = "" Me.TextBox2.Text = "" Me.TextBox3.Text = "" EndSub PrivateSub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click End EndSub

REALIZAR UN PROGRAMA PARA CALCULAR MAYOR Y EL MENOR DE LOS NUMEROS FORMULARIO

CODIGO FUENTE PublicClass Form2 Dim X, Y, Z, R AsInteger PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = X TextBox2.Text = Y TextBox3.Text = Z If (X < Y) And (X > Z) Then

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR MsgBox("EL PRIMER NUMERO ES EL MAYOR") Else MsgBox("EL PRIMER NUMERO ES MENOR") EndIf If (Y < X) And (Y > Z) Then MsgBox("EL SEGUNDO NUMERO ES EL MAYOR") Else MsgBox("EL SEGUNDO NUMERO ES MENOR") EndIf If (Z < X) And (Z > Y) Then MsgBox("EL TERCER NUMERO ES EL MAYOR") Else MsgBox("EL TERCER NUMERO ES MENOR") EndIf MsgBox("LOS NUMERO SON IGUALES") EndSub PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.TextBox1.Text = "" Me.TextBox2.Text = "" Me.TextBox3.Text = "" EndSub PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End EndSub PrivateSub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click EndSub EndClass

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PROGRAMAS CON SELECT CASE VALIDACION DE FECHA Y 3 MAS FORMULARIO

CODIGO FUENTE Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a, m, d, d1, bis As Integer a = Mid(TextBox1.Text, 1, 4) m = Mid(TextBox1.Text, 6, 2) d1 = Mid(TextBox1.Text, 9, 2) bis = a Mod (4) If a < 1900 Or a > 2014 Then MsgBox("Ingrese otro a単o") TextBox1.Text = "" Else If m <= 0 Or m > 12 Then MsgBox("Ingrese otro mes") TextBox1.Text = "" Else Select Case m Case 1, 3, 5, 7, 8, 10, 12 d = 31 Case 4, 6, 9, 11 d = 31 VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Case 2 If bis = 0 Then d = 29 Else d = 28 End If End Select If d1 > d Then MsgBox("Ingrese otro dia") TextBox1.Text = "" Else MsgBox("fecha validada") TextBox1.Text = "" End If End If End If End Sub End Class PROGRAMA PARA ESCRIBIR UN NÚMERO Y DESPLEGUE ELDIA CORRESPONDIENTE FORMULARIO

Public Class Form2

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR 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 TextBox2.Text = "viernes" Case 6 TextBox2.Text = "sabado" Case 7 TextBox2.Text = "domingo" End Select End Sub End Class REALIZAR UN PROGRAMA PARA ELEGIR LOS DIAS DE LA SEMANA CON COMBO BOX FORMULARIO

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Public Class Form3 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 = ComboBox1.SelectedItem Case 1 TextBox1.Text = ComboBox1.SelectedItem Case 2 TextBox1.Text = ComboBox1.SelectedItem Case 3 TextBox1.Text = ComboBox1.SelectedItem Case 4 TextBox1.Text = ComboBox1.SelectedItem Case 5 TextBox1.Text = ComboBox1.SelectedItem Case 6 TextBox1.Text = ComboBox1.SelectedItem End Select End Sub Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.Items.Add("lunes") ComboBox1.Items.Add("martes") ComboBox1.Items.Add("miercoles") ComboBox1.Items.Add("jueves") ComboBox1.Items.Add("viernes") ComboBox1.Items.Add("sabado") ComboBox1.Items.Add("domingo")

End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR REALIZAR UN PROGRAMA PARA PARPADEAR LAS PALABRAS EN LABEL FORMULARIO

CODIGO FUENTE Public Class Form4 Dim cont As Integer = 0 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If cont = "5" Then cont = "1" Else : cont = cont + 1 Select Case cont Case 1 Label2.Visible = True Label3.Visible = False Label4.Visible = False Label5.Visible = False Label6.Visible = False VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Case 2 Label2.Visible = False Label3.Visible = True Label4.Visible = False Label5.Visible = False Label6.Visible = False Case 3 Label2.Visible = False Label3.Visible = False Label4.Visible = True Label5.Visible = False Label6.Visible = False Case 4 Label2.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = True Label6.Visible = False Case 5 Label2.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = False Label6.Visible = True End Select End If End Sub Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Start() End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR REALIZAR UNN EJERCICIO PARA INGRESAR TU NOMBRE Y CONTRASEÑA FORMULARIO

CÓDIGO FUENTE Public Class Form1 Dim cons As Integer = 0 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

ProgressBar1.Increment(5) If ProgressBar1.Value = 100 Then Form2.Show() Else End If If cons = "3" Then cons = "1" Else cons = cons + 1 Select Case cons Case 1 Label1.Visible = True Label5.Visible = False Label6.Visible = False VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Case 2 Label1.Visible = False Label5.Visible = True Label6.Visible = False Case 3 Label1.Visible = False Label5.Visible = False Label6.Visible = True End Select End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "Valery" And TextBox2.Text = "Collette3" Then Timer1.Start()

Else MsgBox("INGRESE DATOS CORRECTOS") TextBox1.Text = "" TextBox2.Text = "" End If End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick Timer1.Start() End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PROGRAMA PARA PODER ELEGIR CON UN MENU FORMULARIO

CÓDIGO FUENTE Public Class Form1 Private Sub CUADRADOToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CUADRADOToolStripMenuItem.Click Form2.Show() Form1.Hide() End Sub Private Sub RECTANGULOToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RECTANGULOToolStripMenuItem.Click Form3.Show() Form1.Hide() End Sub Private Sub CIRCULOToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CIRCULOToolStripMenuItem.Click Form4.Show() Form1.Hide() End Sub

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub TRIANGULOToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TRIANGULOToolStripMenuItem.Click Form5.Show() Form1.Hide() End Sub Private Sub ARCHIVOToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ARCHIVOToolStripMenuItem.Click End Sub End Class RELIZAR UN PROGRAMA PARA INGRESAR DOS COLUMNAS CON REDIM FORMULARIO

CÓDIGO FUENTE Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sum(), num() As Integer, tum, nn As Integer ReDim sum(0 To nn) ReDim num(0 To nn) TextBox1.Text = InputBox("ingrese numeros") TextBox2.Text = InputBox("ingrese otros numeros") VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR sum(tum) = Val(TextBox1.Text) For tum = 1 To sum(tum) sum(tum) = InputBox("ingrese otros numeros") ListBox1.Items.Add(sum(tum)) Next tum nn = sum(tum) + tum tum = Val(TextBox2.Text) ReDim Preserve num(nn) For tum = 1 To sum(tum) sum(tum) = InputBox("ingrese otros numeros") Next tum For tum = 1 To nn ListBox2.Items.Add(tum) Next End Sub End Class PROGRAMA DE IMPRIMIR EN CONSOLA FECHA

CODIGO FUENTE Module Module1 Sub Main() Dim aDateString, aTimeString As String Dim aDate, aTime As Date aDateString = "February 12, 1969" aTimeString = VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR "4:35:47 PM" ' The following line of code sets aDate to a Date value. aDate = CDate(aDateString) ' The following line of code sets aTime to Date value. aTime = CDate(aTimeString) Console.WriteLine(aDateString) Console.WriteLine(aTimeString) Console.WriteLine(aDate) Console.WriteLine(aTime) Console.ReadLine() End Sub End Module REALIZAR PROGRAMA DEPENDIENDO A EL INGRESO SACARA CARITA FELIZ O TRISTE FORMULARIO

CODIGO FUENTE Public Class Form1 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 VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR TextBox2.Text = num2 PictureBox3.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 Dim r As Integer r = Val(TextBox1.Text) + Val(TextBox2.Text) If (Val(TextBox3.Text)) = Val(TextBox1.Text) + Val(TextBox2.Text) Then PictureBox3.Image = feliz.Image Else PictureBox3.Image = triste.Image End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub End Class REALIZAR UN PROGRAMA PARA EL JUEGO DE MEMORIA FORMULARIO

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR CĂ“DIGO FUENTE Public Class Form2 Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click, PictureBox8.Click End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click PictureBox1.Visible = True End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click PictureBox6.Visible = True End Sub Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click PictureBox2.Visible = True End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click PictureBox3.Visible = True End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click PictureBox4.Visible = True End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click PictureBox7.Visible = True End Sub VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click PictureBox8.Visible = True End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click PictureBox5.Visible = True End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If PictureBox1.Visible = True And PictureBox5.Visible = True Then PictureBox1.Visible = True Else PictureBox1.Visible = False End If End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick If PictureBox2.Visible = True And PictureBox8.Visible = True Then PictureBox2.Visible = True Else PictureBox2.Visible = False End If End Sub Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick If PictureBox3.Visible = True And PictureBox6.Visible = True Then PictureBox3.Visible = True Else PictureBox3.Visible = False End If End Sub Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick If PictureBox4.Visible = True And PictureBox7.Visible = True Then PictureBox4.Visible = True Else VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PictureBox4.Visible = False End If End Sub Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick If PictureBox5.Visible = True And PictureBox1.Visible = True Then PictureBox5.Visible = True Else PictureBox5.Visible = False End If End Sub Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick If PictureBox6.Visible = True And PictureBox3.Visible = True Then PictureBox6.Visible = True Else PictureBox6.Visible = False End If End Sub Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer7.Tick If PictureBox7.Visible = True And PictureBox4.Visible = True Then PictureBox7.Visible = True Else PictureBox7.Visible = False End If End Sub Private Sub Timer8_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer8.Tick If PictureBox8.Visible = True And PictureBox2.Visible = True Then PictureBox8.Visible = True Else PictureBox8.Visible = False End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click PictureBox1.Visible = False VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PictureBox2.Visible = False PictureBox3.Visible = False PictureBox4.Visible = False PictureBox5.Visible = False PictureBox6.Visible = False PictureBox7.Visible = False PictureBox8.Visible = False End Sub End Class REALIZAR PROGRAMA PARA ENLAZAR LOS FORMULARIO FORMULARIO

CÓDIGO FUENTE FORM 8 Public Class Form8 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Dim a, b, c As Integer a = TextBox1.Text b = TextBox2.Text c=a+b TextBox3.Text = c End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Form9.Show() Me.Hide() End Sub End Class CODIGO FUENTE FORM 9 Public Class Form9 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a As Integer = 10 Dim r As Boolean r=5>a TextBox1.Text = r End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PROGRAMA PARA ANIMACION DE LETRAS FORMULARIO

CĂ“DIGO FUENTE Public Class Form4 Dim cont As Integer = 0 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If cont = "5" Then cont = "1" Else : cont = cont + 1 Select Case cont Case 1 Label2.Visible = True Label3.Visible = False Label4.Visible = False Label5.Visible = False Label6.Visible = False VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Case 2 Label2.Visible = False Label3.Visible = True Label4.Visible = False Label5.Visible = False Label6.Visible = False Case 3 Label2.Visible = False Label3.Visible = False Label4.Visible = True Label5.Visible = False Label6.Visible = False Case 4 Label2.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = True Label6.Visible = False Case 5 Label2.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = False Label6.Visible = True End Select End If End Sub Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Start() End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PROGRAMA PARA UNIR TEXTOS FORMULARIOS

CÓDIGO FUENTE Public Class Form7 Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged TextBox1.Text = "CENTRAL" End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged TextBox1.Text = "UNIVERSIDAD" End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR REALIZAR UN PROGRAMA PARA AÑADIR TEXTO EN UN LISTBOX FORMULARIO

CÓDIGO FUENTE Public Class Form6 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ListBox1.Items.Add(TextBox1.Text) TextBox1.Text = "" TextBox1.Focus() End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR ELABORAR UN PROGRAMA PARA SOBREPONER UN TEXTO FORMULARIO

CÓDIGO FUENTE Public Class Form5 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HHH.Click NOMBRE.TEXT = "UMIVERSIDAD CENTRAL" End Sub End Class ELABORAR UN PROGRAMA PARA SUMAR FORMULARIO

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR CÓDIGO FUENTE Public Class Form1 Public Function suma() As Integer Return Val(TextBox1.Text) + Val(TextBox2.Text) End Function Public Sub limpiar() TextBox1.Text = "" TextBox2.Text = "" Label1.Text = "" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = suma() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click limpiar() End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class REALIZAR UN PROGRAMA EN QUE AL PASAR EL MOUSE CAMBIA COLOR Y FUENTE FORMULARIO

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.BackColor = Color.Aquamarine End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Text = "primer formulario" Me.ForeColor = Color.Yellow End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub End Class PROGRAMA QUE CAMBIA POR EVENTO COLORES Y NOMBRES DEL FORMULARIO FORMULARIO

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click LABEL1.TEXT = "MI SEGUNDO FORMILARIO" End Sub Private Sub Button2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button2.MouseMove Me.BackColor = Color.Blue End Sub Private Sub Button3_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button3.MouseDoubleClick Label1.ForeColor = Color.BurlyWood End Sub End Class REALIZAR PROGRAMA QUE VISUALICE UNA IMAGEN Y OCULTE FORMULARIO

Public Class Form3

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click IMAGEN1.Visible = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click IMAGEN1.Visible = False End Sub End Class PROGRAMA PARA DESPLEGAR TEXTO FORMULARIO

Public Class Form5 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HHH.Click NOMBRE.TEXT = "UMIVERSIDAD CENTRAL" End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR ELABORAR UN PROGRAMA PARA REALIZAR LAS OPERACIONES BÁSICAS EN LISTBOX FORMULARIO

Public Class Form9 Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NUM3.TextChanged End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.BackColor = Color.Aqua Me.Close() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click NUM3.Text = Val(NUM1.Text) + Val(NUM2.Text) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click NUM3.Text = Val(NUM1.Text) - Val(NUM2.Text) End Sub VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click NUM3.Text = Val(NUM1.Text) * Val(NUM2.Text) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click NUM3.Text = Val(NUM1.Text) / Val(NUM2.Text) End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click ListBox1.Items.Add(NUM3.Text) NUM3.Text = "" NUM3.Focus() End Sub End Class OPERACIONES BASICAS INGRESANDO DOS NUMEROS FORMULARIO

Public Class Form8 Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click NUM3.Text = Val(NUM1.Text) + Val(NUM2.Text) End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.Close() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click NUM3.Text = Val(NUM1.Text) * Val(NUM2.Text) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click NUM3.Text = Val(NUM1.Text) - Val(NUM2.Text) End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click NUM1.Text = "" NUM2.Text = "" NUM3.Text = "" NUM1.Focus() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click NUM3.Text = Val(NUM1.Text) / Val(NUM2.Text) End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PROGRAMA CON WHILE, DO WHILE, DO FORMULARIO

Public Class Form1 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click End End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim X As Integer Do While X < 10 TextBox3.Text = TextBox3.Text & X.ToString & " " X=X+1 Loop End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim X As Integer Do TextBox2.Text = TextBox2.Text & X.ToString & "" X=X+1 Loop Until X >= 10 End Sub VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim X As Integer While X <= 10 TextBox1.Text = TextBox1.Text & X.ToString & "" X += 1 End While End Sub End Class REALIZAR PROGRAMA PARA DESPLEGAR FECHA DIA Y HORA FORMULARIO

Public Class Form2 Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim aDateString, aTimeString As String Dim aDate, aTime As Date aDateString = "February 12, 1969" VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR aTimeString = "4:35:47 PM" ' The following line of code sets aDate to a Date value. aDate = CDate(aDateString) ' The following line of code sets aTime to Date value. aTime = CDate(aTimeString) TextBox1.Text = aDateString TextBox2.Text = aTimeString TextBox3.Text = aDate TextBox4.Text = aTime End Sub End Class REALIZAR UN PROGRAMA PARA DEL TEXTO IDENTIFICAR CUANTAS VOCALES FORMULARIO

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged Dim CONT As Integer Dim EX As String Dim N As Integer N = Len(TextBox1.Text) TextBox2.Text = N For I = 1 To N Step 1 EX = Mid(TextBox1.Text, I, 1) TextBox2.Text = EX VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR If EX = "a" Or EX = "A" Then CONT = CONT + 1 End If TextBox2.Text = CONT Next End Sub Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged Dim CONT As Integer Dim EX As String Dim N As Integer N = Len(TextBox1.Text) TextBox2.Text = N For I = 1 To N Step 1 EX = Mid(TextBox1.Text, I, 1) TextBox2.Text = EX If EX = "e" Or EX = "E" Then CONT = CONT + 1 End If TextBox2.Text = CONT Next End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim CONT As Integer Dim EX As String Dim N As Integer N = Len(TextBox1.Text) TextBox2.Text = N For I = 1 To N Step 1 EX = Mid(TextBox1.Text, I, 1) TextBox2.Text = EX If EX = "i" Or EX = "I" Then CONT = CONT + 1 End If VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR TextBox2.Text = CONT Next End Sub Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged Dim CONT As Integer Dim EX As String Dim N As Integer N = Len(TextBox1.Text) TextBox2.Text = N For I = 1 To N Step 1 EX = Mid(TextBox1.Text, I, 1) TextBox2.Text = EX If EX = "o" Or EX = "O" Then CONT = CONT + 1 End If TextBox2.Text = CONT Next End Sub Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged Dim CONT As Integer Dim EX As String Dim N As Integer N = Len(TextBox1.Text) TextBox2.Text = N For I = 1 To N Step 1 EX = Mid(TextBox1.Text, I, 1) TextBox2.Text = EX If EX = "u" Or EX = "U" Then CONT = CONT + 1 End If TextBox2.Text = CONT Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox2.Text = "" End Sub VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR End Class EJERCICIO FUNCION MID LEN FORMULARIO

Public Class Form1 Dim A As Integer Dim EX As String Dim CONT As String = 0 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click A = Len(TextBox1.Text) TextBox2.Text = A For I = 1 To A Step 1 EX = Mid(TextBox1.Text, I, 1) TextBox3.Text = EX If EX = "a" Or EX = "A" Then CONT = CONT + 1 End If TextBox4.Text = CONT Next End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load For I = 1 To A Step 1 VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR EX = Mid(TextBox1.Text, I, 1) TextBox3.Text = EX If EX = "E" Or EX = "e" Then CONT = CONT + 1 End If TextBox4.Text = CONT Next End Sub End Class PROGRAMA PARA REALIZAR CON BARS FORMULARIO

Public Class Form1 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick animar() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Start() End Sub

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "1234" And TextBox2.Text = "1234" Then Timer2.Start() Else MsgBox("User o Pass incorrectos") TextBox1.Text = "" TextBox2.Text = "" TextBox1.Focus() End If End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick ProgressBar1.Increment(8) If ProgressBar1.Value = 100 Then Form2.Show() Me.Hide() End If End Sub End Class PROGRAMA DE VECTORES 4 FORMULARIO

Public Class Form3 Dim N, L, PAR, IMP As Integer VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click N = InputBox("INGRESE POSICIONES") Dim A(N) As Integer For I = 0 To N - 1 A(I) = InputBox("INGRESE VECTORES ") ListBox1.Items.Add(A(I)) If A(I) Mod (2) = 0 Then PAR = PAR + 1 End If IMP = IMP + 1 Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = PAR TextBox2.Text = IMP End Sub End Class PROGRAMA CON VECTORES FORMULARIO

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR 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") Next End Sub End Class

Public Class Form1 Dim A(5), N As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For I = 0 To 4 N = InputBox("INGRESE VECTOR DE 5 POCICIONES ") ListBox1.Items.Add(N) Next End Sub

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR 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 PROGRAMA PARA VALIDAR LA CÉDULA FORMULARIO

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a, par, imp, x, provincia As Integer If Len(TextBox1.Text) > 10 Then MsgBox("CEDULA INCORRECTA") Else provincia = Mid(TextBox1.Text, 1, 2) TextBox3.Text = provincia VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR If provincia = 4 Then TextBox2.Text = " PROVINCIA ES CARCHI" ElseIf provincia = 3 Then TextBox2.Text = " PROVINCIA ES CAÑAR" ElseIf provincia = 2 Then TextBox2.Text = " PROVINCIA ES BOLIVAR" ElseIf provincia = 1 Then TextBox2.Text = " PROVINCIA ES AZUAY" ElseIf provincia = 5 Then TextBox2.Text = " PROVINCIA ES COTOPAXI" ElseIf provincia = 6 Then TextBox2.Text = " PROVINCIA ES CHIMBORAZO" ElseIf provincia = 7 Then TextBox2.Text = " PROVINCIA ES EL ORO" ElseIf provincia = 8 Then TextBox2.Text = " PROVINCIA ES ESMERALDAS" ElseIf provincia = 9 Then TextBox2.Text = " PROVINCIA ES GUAYAS" ElseIf provincia = 10 Then TextBox2.Text = " PROVINCIA ES IMBABURA" ElseIf provincia = 11 Then TextBox2.Text = " PROVINCIA ES LOJA" ElseIf provincia = 12 Then TextBox2.Text = " PROVINCIA ES LOS RIOS" ElseIf provincia = 13 Then TextBox2.Text = " PROVINCIA ES MANABI" ElseIf provincia = 14 Then TextBox2.Text = " PROVINCIA ES MORONA SANTIAGO" ElseIf provincia = 15 Then TextBox2.Text = " PROVINCIA ES NAPO" ElseIf provincia = 16 Then TextBox2.Text = " PROVINCIA ES PASTAZA" ElseIf provincia = 17 Then TextBox2.Text = " PROVINCIA ES PICHINCHA" ElseIf provincia = 18 Then TextBox2.Text = " PROVINCIA ES TUNGURAHUA" ElseIf provincia = 19 Then TextBox2.Text = " PROVINCIA ES ZAMORA CHINCHIPE" ElseIf provincia = 20 Then TextBox2.Text = "PROVINCIA ES GALAPAGOS" ElseIf provincia = 21 Then TextBox2.Text = " PROVINCIA ES SUCUMBIOS" ElseIf provincia = 23 Then VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR TextBox2.Text = " PROVINCIA ES SANTO DOMINGO DE LOS TSACHILAS" ElseIf provincia = 22 Then TextBox2.Text = " PROVINCIA ES ORELLANA" ElseIf provincia = 24 Then TextBox2.Text = " PROVINCIA ES SANTA ELENA" End If For i = 2 To 8 Step 2 par = par + Mid(Val(TextBox1.Text), i, 1)

Next For i = 1 To 9 Step 2 x = Mid(Val(TextBox1.Text), i, 1) * 2

If x >= 9 Then x=x-9 End If imp = imp + x a = par + imp Next x = a Mod 10 If x > 0 Then x = 10 - x End If If x = Val(Mid(TextBox1.Text, 10, 1)) Then MsgBox("EL NUMERO ES VALIDO")

Else MsgBox("NO PASA LA VALIDACION") End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR End End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox2.Text = "" TextBox1.Text = "" TextBox3.Text = "" End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class PROGRAMA PARA SACAR EL FACTORIAL FORMULARIO

Public Class Form3 Dim I, F As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For I = 1 To Val(TextBox1.Text) VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR F=F*I Next TextBox2.Text = F End Sub End Class REALIZAR UN PROGRAMA PARA SACAR EL NÚMERO PAR FORMULARIO

Public Class Form2 Dim I As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For I = 2 To 100 Step 2 ListBox1.Items.Add(I) Next End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PROGRAMA PARA SACAR EL NUMERO PRIMO FORMULARIO

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a As Integer = 0 Dim r, i As Integer r = TextBox1.Text For i = 1 To r Step 1 If r Mod i = 0 Then a=a+1 End If Next If a > 2 Then TextBox2.Text = "No es Primo" Else TextBox2.Text = "Si es Primo" End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR TextBox2.Text = "" TextBox1.Text = "" End Sub End Class PROGRAMA PARAS SACAR EL NUMERO DE FIBONACCI FORMULARIO

Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim TotalNumeros As Integer TotalNumeros = 12 Dim fibonacci(12) As Long Dim i As Integer fibonacci(1) = 1 fibonacci(2) = 1 For i = 3 To TotalNumeros fibonacci(i) = fibonacci(i - 1) + fibonacci(i - 2) Next i For i = 1 To TotalNumeros MsgBox("fibonacci(i)") Next i End Sub End Class VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PROGRAMA DE DO WHILE PARA TABLAS DE MULTIPLICAR FORMULARIO

Public Class Form2 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim R, X As Integer X=1 Do While X <= 12 R=X*1 ComboBox1.Items.Add(R.ToString & "=" & X.ToString & "*" & "1") X=X+1 Loop X=1 Do While X <= 12 R=X*2 ComboBox2.Items.Add(R.ToString & "=" & X.ToString & "*" & "2") X=X+1 Loop X=1 Do While X <= 12 VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR R=X*3 ComboBox3.Items.Add(R.ToString & "=" & X.ToString & "*" & "3") X=X+1 Loop X=1 Do While X <= 12 R=X*4 ComboBox4.Items.Add(R.ToString & "=" & X.ToString & "*" & "4") X=X+1 Loop X=1 Do While X <= 12 R=X*5 ComboBox5.Items.Add(R.ToString & "=" & X.ToString & "*" & "5") X=X+1 Loop X=1 Do While X <= 12 R=X*6 ComboBox6.Items.Add(R.ToString & "=" & X.ToString & "*" & "6") X=X+1 Loop X=1 Do While X <= 12 R=X*7 ComboBox7.Items.Add(R.ToString & "=" & X.ToString & "*" & "7") X=X+1 Loop X=1 Do While X <= 12 R=X*8 ComboBox8.Items.Add(R.ToString & "=" & X.ToString & "*" & "8") X=X+1 Loop X=1 Do While X <= 12 R=X*9 ComboBox9.Items.Add(R.ToString & "=" & X.ToString & "*" & "9") X=X+1 Loop X=1 Do While X <= 12 R = X * 10 VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR ComboBox10.Items.Add(R.ToString & "=" & X.ToString & "*" & "10") X=X+1 Loop X=1 Do While X <= 12 R = X * 11 ComboBox11.Items.Add(R.ToString & "=" & X.ToString & "*" & "11") X=X+1 Loop X=1 Do While X <= 12 R = X * 12 ComboBox12.Items.Add(R.ToString & "=" & X.ToString & "*" & "12") X=X+1 Loop End Sub End Class PROGRAMA DE SYSTEM IO AGENDA FORMULARIO

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Imports System Imports System.IO Imports System.Text Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim path As String = "C:\Users\lab_infor_25\Desktop\Datos del registro.txt" If File.Exists(path) = False Then Dim datos As StreamWriter = File.CreateText(path) datos.WriteLine("Nombre: " + TextBox1.Text + "Apellido: " + TextBox2.Text + "Tel茅fono: " + TextBox3.Text + "Direcci贸n: " + TextBox4.Text + "Estado civil: " + ComboBox1.SelectedItem) datos.Close() Else MsgBox("Desea reemplazar el archivo existente", MsgBoxStyle.YesNoCancel) End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 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 End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR PROGRAMA DE VALIDAR Aテ前,MES Y DIA FORMULARIO

Public Class Form1 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a, m, d, d1, bis As Integer a = Mid(TextBox1.Text, 1, 4) m = Mid(TextBox1.Text, 6, 2) d1 = Mid(TextBox1.Text, 9, 2) bis = a Mod (4) If a < 1900 Or a > 2014 Then MsgBox("INGRESE OTRO Aテ前") TextBox1.Text = "" Else If m <= 0 Or m > 12 Then MsgBox("INGRESE OTRO MES") TextBox1.Text = "" Else Select Case m VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Case 1, 3, 5, 7, 8, 10, 12 d = 31 Case 4, 6, 9, 11 d = 31 Case 2 If bis = 0 Then d = 29 Else d = 28 End If End Select If d1 > d Then MsgBox("INGRESE OTRO DIA") TextBox1.Text = "" Else MsgBox("FECHA VALIDA") TextBox1.Text = "" End If End If End If End Sub End Class PROGRAMA PARA INGRESAR NUMERO Y SACAR PARES IMPARES FORMULARIO

Public Class Form3 Dim N, L, PAR, IMP As Integer VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click N = InputBox("INGRESE POSICIONES") Dim A(N) As Integer For I = 0 To N - 1 A(I) = InputBox("INGRESE VECTORES ") ListBox1.Items.Add(A(I)) If A(I) Mod (2) = 0 Then PAR = PAR + 1 End If IMP = IMP + 1 Next

End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = PAR TextBox2.Text = IMP End Sub End Class TRES PROGRAMAS CON INPUTBOX FORMULARIO

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim nfa, nca As Integer Dim nfb, ncb As Integer Dim acu As Integer nfa = InputBox("Número de filas de la Matriz A") nca = InputBox("Número de columnas de la Matriz A") nfb = InputBox("Número de filas de la Matriz B") ncb = InputBox("Número de columnas de la Matriz B") If nca = nfb Then Dim a(nfa, nca), b(nfb, ncb), r(nfa, ncb) As Integer

For I = 1 To nfa For j = 1 To nca a(I, j) = InputBox(" ingrese numeros") ListBox1.Items.Add(a(I, j)) Next Next For I = 1 To nfb For j = 1 To ncb b(I, j) = InputBox(" ingrese numeros") ListBox2.Items.Add(b(I, j)) Next Next For i = 1 To nfa For J = 1 To ncb For K = 1 To nfb acu = a(i, K) * b(K, J) + acu Next r(i, J) = acu ListBox3.Items.Add(r(i, J)) acu = 0 Next Next VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Else MsgBox("no existe ") End If End Sub End Class

Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim mat(3, 3) As Integer For i = 1 To 3 For j = 1 To 3 mat(i, j) = InputBox("ingrese la matriz") ListBox1.Items.Add(mat(i, j)) Next Next End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a(2, 3), b(3, 2), r(2, 2) As Integer Dim acu As Integer For I = 1 To 2 For j = 1 To 3 a(I, j) = InputBox(" ingrese numeros") ListBox1.Items.Add(a(I, j)) Next Next For I = 1 To 3 For j = 1 To 2 b(I, j) = InputBox(" ingrese numeros") ListBox2.Items.Add(b(I, j)) Next Next For I = 1 To 2 For J = 1 To 2 For K = 1 To 3 acu = a(I, K) * b(K, J) + acu VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Next r(I, J) = acu ListBox3.Items.Add(r(I, J)) acu = 0 Next Next End Sub End Class PROGRAMA CON CADENA DE CARACTERES FORMULARIO

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox2.Text = Mid(TextBox1.Text, 2, 2) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox2.Text = Len(TextBox1.Text) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR TextBox2.Text = Microsoft.VisualBasic.Left(TextBox1.Text, 5) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox2.Text = Microsoft.VisualBasic.Right(TextBox1.Text, 5) End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click TextBox2.Text = Microsoft.VisualBasic.Trim(TextBox1.Text) End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click TextBox2.Text = Space(TextBox1.Text) End Sub End Class PROGRAMA PARA SABER DEPENDIENDO LA HORACON UN MSGBOX DIGA SI ES TARDE,MAÑANA O NOCHE FORMULARIO

Public Class Form1

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim H As Integer H = TextBox1.Text Select Case H Case 1 To 5 MsgBox("MADRUGADA") Case 6 To 11 MsgBox("MAÑANA") Case 12 To 18 MsgBox("TARDE") Case 18 To 24 MsgBox("NOCHE") End Select End Sub End Class PROGRAMA DE POTENCIA FORMULARIO

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Resultado, I As Integer VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Resultado = 1 For I = 1 To Val(TextBox2.Text) Resultado = Resultado * Val(TextBox1.Text) Next I TextBox3.Text = Resultado End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class PROGRAMA DEL NĂšMERO POSITIVO Y NEGATIVO FORMULARIO

Public Class Form13 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR TextBox2.Text = "" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim n As Integer n = TextBox1.Text If (n = 0) Then TextBox2.Text = " NUMERO " + Trim(n) + " NULO" Else If (n > 0) Then TextBox2.Text = "NUMERO " + Trim(n) + " POSITIVO" Else TextBox2.Text = "NUMERO " + Trim(n) + " NEGATIVO" End If End If End Sub End Class PROGRAMA PARA DESPLEGAR Msgbox FORMULARIO

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("FIN PROGRAMA", vbOKOnly + vbCritical, "Informaci贸n") VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR End End Sub End Class

Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("驴DESEAS SEGUIR?", vbYesNo, "Informaci贸n importante") End Sub End Class

VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim intRespuesta As Integer intRespuesta = MsgBox("¿DESEAS SEGUIR?", vbQuestion + vbYesNo, "Información importante") If intRespuesta = 6 Then MsgBox("Seguimos") Else MsgBox("Terminamos") End End If End Sub End Class PROGRAMA PARA VALIDAR CÉDULA CON IF ELSEIF END IF FORMULARIO

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a, par, imp, x, provincia As Integer VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR If Len(TextBox1.Text) > 10 Then MsgBox("CEDULA INCORRECTA") Else provincia = Mid(TextBox1.Text, 1, 2) TextBox3.Text = provincia If provincia = 4 Then TextBox2.Text = " PROVINCIA ES CARCHI" ElseIf provincia = 3 Then TextBox2.Text = " PROVINCIA ES CAÑAR" ElseIf provincia = 2 Then TextBox2.Text = " PROVINCIA ES BOLIVAR" ElseIf provincia = 1 Then TextBox2.Text = " PROVINCIA ES AZUAY" ElseIf provincia = 5 Then TextBox2.Text = " PROVINCIA ES COTOPAXI" ElseIf provincia = 6 Then TextBox2.Text = " PROVINCIA ES CHIMBORAZO" ElseIf provincia = 7 Then TextBox2.Text = " PROVINCIA ES EL ORO" ElseIf provincia = 8 Then TextBox2.Text = " PROVINCIA ES ESMERALDAS" ElseIf provincia = 9 Then TextBox2.Text = " PROVINCIA ES GUAYAS" ElseIf provincia = 10 Then TextBox2.Text = " PROVINCIA ES IMBABURA" ElseIf provincia = 11 Then TextBox2.Text = " PROVINCIA ES LOJA" ElseIf provincia = 12 Then TextBox2.Text = " PROVINCIA ES LOS RIOS" ElseIf provincia = 13 Then TextBox2.Text = " PROVINCIA ES MANABI" ElseIf provincia = 14 Then TextBox2.Text = " PROVINCIA ES MORONA SANTIAGO" ElseIf provincia = 15 Then TextBox2.Text = " PROVINCIA ES NAPO" ElseIf provincia = 16 Then TextBox2.Text = " PROVINCIA ES PASTAZA" ElseIf provincia = 17 Then TextBox2.Text = " PROVINCIA ES PICHINCHA" ElseIf provincia = 18 Then TextBox2.Text = " PROVINCIA ES TUNGURAHUA" ElseIf provincia = 19 Then VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR TextBox2.Text = " PROVINCIA ES ZAMORA CHINCHIPE" ElseIf provincia = 20 Then TextBox2.Text = "PROVINCIA ES GALAPAGOS" ElseIf provincia = 21 Then TextBox2.Text = " PROVINCIA ES SUCUMBIOS" ElseIf provincia = 23 Then TextBox2.Text = " PROVINCIA ES SANTO DOMINGO DE LOS TSACHILAS" ElseIf provincia = 22 Then TextBox2.Text = " PROVINCIA ES ORELLANA" ElseIf provincia = 24 Then TextBox2.Text = " PROVINCIA ES SANTA ELENA" End If For i = 2 To 8 Step 2 par = par + Mid(Val(TextBox1.Text), i, 1) Next For i = 1 To 9 Step 2 x = Mid(Val(TextBox1.Text), i, 1) * 2 If x >= 9 Then x=x-9 End If imp = imp + x a = par + imp Next x = a Mod 10 If x > 0 Then x = 10 - x End If If x = Val(Mid(TextBox1.Text, 10, 1)) Then MsgBox("NUMERO DE CEDULA CORRECTO") Else MsgBox("NUMERO DE CEDULA NO VALIDADA") End If End If End Sub VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox2.Text = "" TextBox1.Text = "" TextBox3.Text = "" End Sub End Class PROGRAMA PARA EL SIMULADOR DE WEB FORMULARIO

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click WebBrowser1.Navigate(TextBox1.Text) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click WebBrowser1.GoBack() VALERIA TOAPANTA

4TO SEMESTRE


UNIVERSIDAD CENTRAL DEL ECUADOR End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click WebBrowser1.Refresh() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click WebBrowser1.GoForward() End Sub

VALERIA TOAPANTA

4TO SEMESTRE


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.