83
Leonel Navarrete NAVARRETE MONTENEGRO ERIK LEONEL

Programación .Net

  • Upload
    leonel

  • View
    228

  • Download
    2

Embed Size (px)

DESCRIPTION

 

Citation preview

Leonel Navarrete

NAVARRETE MONTENEGRO ER IK LEONEL

Leonel Navarrete

Unión de Caracteres

Public Class Form2

Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton1.Click

Dim texto1, texto2 As Stringtexto1 = TextBox1.Texttexto2 = TextBox2.TextTextBox3.Text = texto1 + texto2

End Sub

Private Sub Button2_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton2.Click

Dim texto1, texto2 As Stringtexto1 = TextBox1.Texttexto2 = TextBox2.TextTextBox4.Text = texto1 & texto2

End SubEnd Class

Leonel Navarrete

Manipular caracteres con MID

Diseño

Programación

Ejecución

Leonel Navarrete

Diseño

Programación

Ejecución

Manipular caracteres con LEN

Leonel Navarrete

Diseño

Programación

Ejecución

Manipular caracteres con LEFT

Leonel Navarrete

Diseño

Programación

Ejecución

Manipular caracteres con RIGHT

Leonel Navarrete

Diseño

Programación

Ejecución

Manipular caracteres con SPACE

Leonel Navarrete

Diseño

Programación

Ejecución

Manipular caracteres con TRIM

Leonel Navarrete

Programación Form 1

Enlazar Formularios

Leonel Navarrete

Programación Form 2

Enlazar Formularios

Leonel Navarrete

Convertir Caracteres

Programación Form 1

Leonel Navarrete

Convertir Caracteres

Programación Form 2

Leonel Navarrete

EDADES

Leonel Navarrete

System IO

Leonel Navarrete

Select Case Con LABEL

Leonel Navarrete

Con MSGBOX

MsgBox

Select Case

Leonel Navarrete

Usuario y Contraseña

Leonel Navarrete

Juego de Cartas

Leonel Navarrete

Juego de Cartas

Leonel Navarrete

Usuario y Contraseña con Progress Bar

Leonel Navarrete

Funciones Y Procedimientos

Leonel Navarrete

Funciones Y Procedimientos

Leonel Navarrete

Funciones Y Procedimientos

Leonel Navarrete

ANIMACIÓN DE LETRASFunciones Y Procedimientos

Leonel Navarrete

Propiedades de los objetos

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Me.BackColor = Color.CrimsonEnd 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.Blue

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

EndEnd Sub

End Class

Leonel Navarrete

Propiedades de los objetos

Public Class Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Label1.Text = "mi segundo formulario"End Sub

Private Sub Button2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) HandlesButton2.MouseMove

Me.BackColor = Color.GoldEnd Sub

Private Sub Button3_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.DoubleClick

Me.BackColor = Color.CyanEnd Sub

End Class

Leonel Navarrete

Propiedades de los objetos

Public Class Form3

Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton1.Click

imagen1.Visible = True

End Sub

Private Sub Button2_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton2.Click

imagen1.Visible = False

End SubEnd Class

Leonel Navarrete

Propiedades de los objetos

Public Class Form4

Private Sub Timer1_Tick(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesTimer1.Tick

TextBox1.Text = Date.NowTextBox2.Text = TimeOfDay

End Sub

End Class

Leonel Navarrete

Propiedades de los objetos

Public Class Form5

Private Sub cambiar_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) Handlescambiar.Click

nombre.Text = "Programación“

End SubEnd Class

Leonel Navarrete

Propiedades de los objetos

Public Class Form6

Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton1.Click

ListBox1.Items.Add(TextBox1.Text)TextBox1.Text = ""TextBox1.Focus()

End SubEnd Class

Leonel Navarrete

Propiedades de los objetos

Public Class Form7

Private Sub CheckBox1_CheckedChanged(ByVal senderAs System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

TextBox1.Text = "Programación"End Sub

Private Sub CheckBox2_CheckedChanged(ByVal senderAs System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged

TextBox1.Text = "INFORMÁTICA"End Sub

End Class

Leonel Navarrete

Propiedades de los objetos

Public Class Form8

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

num3.Text = Val(num1.Text) + Val(num2.Text)End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button6.Click

num1.Text = ""num2.Text = ""num3.Text = ""num1.Focus()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

num3.Text = Val(num1.Text) - Val(num2.Text)End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e AsSystem.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 AsSystem.EventArgs) Handles Button4.Click

num3.Text = Val(num1.Text) / Val(num2.Text)End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button5.Click

Me.Close()End Sub

End Class

Leonel Navarrete

Propiedades de los objetos

Public Class Form9

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

num3.Text = Val(num1.Text) + Val(num2.Text)ListBox1.Items.Add(num3.Text)num3.Text = Val(num1.Text) - Val(num2.Text)ListBox1.Items.Add(num3.Text)num3.Text = Val(num1.Text) * Val(num2.Text)ListBox1.Items.Add(num3.Text)num3.Text = Val(num1.Text) / Val(num2.Text)ListBox1.Items.Add(num3.Text)

End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button6.Click

num1.Text = ""num2.Text = ""num3.Text = ""num1.Focus()

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button5.Click

EndEnd Sub

End Class

Leonel Navarrete

Utilizando un Módulo

Module Module1Public Contador As Integer = 0Public u, c, d As ObjectPublic Sub animacion()

If Contador = 3 ThenContador = 0

ElseContador = Contador + 1Select Case Contador

Case 1u.Visible = Truec.Visible = Falsed.Visible = False

Case 2u.Visible = Falsec.Visible = Trued.Visible = False

Case 3u.Visible = Falsec.Visible = Falsed.Visible = True

End SelectEnd If

End SubEnd Module

Leonel Navarrete

Utilizando un Módulo

Public Class Form1Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles MyBase.Loadu = Label1()c = Label2()d = Label3Timer1.Start()

End SubPrivate Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Timer1.Tickanimacion()

End SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button1.ClickIf TextBox1.Text = "Leo" And Val(TextBox2.Text) = 123 Then

Timer2.Start()Else

MsgBox("Usuario o contraseña incorrecto", MsgBoxStyle.Critical)

End IfEnd SubPrivate Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Timer2.TickProgressBar1.Increment(1)If ProgressBar1.Value = 100 Then

Me.Hide()Form2.Show()Timer2.Stop()

End IfEnd Sub

End Class

Leonel Navarrete

Utilizando un Módulo

Public Class Form2Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

MyBase.Loadu = Label1()c = Label2()d = Label3Timer1.Start()

End Sub

Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles SalirToolStripMenuItem.Click

EndEnd Sub

Private Sub CuadradoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles CuadradoToolStripMenuItem.Click

Me.Hide()Form3.Show()

End Sub

Private Sub RectánguloToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles RectánguloToolStripMenuItem.Click

Me.Hide()Form5.Show()

End Sub

Private Sub TriánguloToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles TriánguloToolStripMenuItem.Click

Me.Hide()Form4.Show()

End Sub

Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

animacion()End SubPrivate Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As

System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMoveu = Label1()c = Label2()d = Label3()Timer1.Start()

End Sub

End Class

Leonel Navarrete

Utilizando un Módulo

Public Class Form3

Private Sub MenúPrincipalToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesMenúPrincipalToolStripMenuItem.Click

Form2.Show()Me.Hide()

End Sub

Private Sub SalirToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesSalirToolStripMenuItem.Click

EndEnd Sub

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load

u = Label1()c = Label2()d = Label3Timer1.Start()

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Timer1.Tick

animacion()End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Label7.Text = Val(TextBox1.Text) * 4Label8.Text = Val(TextBox1.Text) * Val(TextBox1.Text)

End SubEnd Class

Leonel Navarrete

Utilizando un Módulo

Public Class Form4

Private Sub MenúPrincipalToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesMenúPrincipalToolStripMenuItem.Click

Form2.Show()Me.Hide()

End Sub

Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click

EndEnd Sub

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load

u = Label1()c = Label2()d = Label3Timer1.Start()

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e AsSystem.EventArgs)

animacion()End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Label7.Text = Val(TextBox1.Text) * 2 + Val(TextBox2.Text) * 2Label8.Text = Val(TextBox1.Text) * Val(TextBox2.Text)

End SubEnd Class

Leonel Navarrete

Utilizando un Módulo

Public Class Form5

Private Sub MenúPrincipalToolStripMenuItem_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesMenúPrincipalToolStripMenuItem.Click

Form2.Show()Me.Hide()

End Sub

Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click

EndEnd Sub

Private Sub Form5_Load(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load

u = Label1()c = Label2()d = Label3Timer1.Start()

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim p, h As Double

Label7.Text = Val(TextBox1.Text) + Val(TextBox2.Text) + Val(TextBox3.Text)

p = (Val(Label7.Text) / 2)h = (p * (p - Val(TextBox1.Text)) * (p - Val(TextBox2.Text)) * (p -

Val(TextBox3.Text))) ^ (1 / 2)Label8.Text = (Val(TextBox1.Text) * h) / 2

End SubEnd Class

Leonel Navarrete

Aplicación 1

Leonel Navarrete

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

N3.Text = Val(N1.Text) + Val(N2.Text)End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

N3.Text = Val(N1.Text) - Val(N2.Text)End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button3.Click

N3.Text = Val(N1.Text) * Val(N2.Text)End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button4.Click

N3.Text = Val(N1.Text) / Val(N2.Text)End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button5.Click

N3.Text = Val(N1.Text) \ Val(N2.Text)End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button6.Click

N3.Text = Val(N1.Text) ^ Val(N2.Text)End SubPrivate Sub Button7_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button7.ClickN3.Text = Val(N1.Text) Mod Val(N2.Text)

End SubPrivate Sub Button10_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button10.ClickN1.Text = ""N2.Text = ""N3.Text = ""N1.Focus()

End SubPrivate Sub Button8_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button8.ClickMe.Close()

End SubPrivate Sub Button9_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button9.ClickMe.Hide()Form2.show()

End SubEnd Class

Leonel Navarrete

Boolean

Public Class Form3

Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton1.Click

Dim A As IntegerDim RES As BooleanA = TextBox1.TextRES = Not (A + 10 < 20)MsgBox(RES)

End SubPrivate Sub Button2_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) HandlesButton2.Click

EndEnd Sub

End Class

Leonel Navarrete

Public Class Form2

Private Sub salario_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles salario.Click

Dim SB, HT, PPH, D, SN As DoubleHT = Val(HORAST.Text)PPH = Val(PAGOH.Text)SB = HT * PPHD = SB * 0.2SN = SB - DSALARION.Text = SN

End Sub

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button10.Click

NOMBREA.Text = ""HORAST.Text = ""PAGOH.Text = ""SALARION.Text = ""

End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button8.Click

Form1.Close()

End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button9.Click

Form3.Show()Me.Hide()

End SubEnd Class

Leonel Navarrete

Public Class Form3

Private Sub salario_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles salario.Click

Dim C, V, VT, I, TC = Val(CANT.Text)V = Val(VUNI.Text)VT = C * VI = VT * 0.12T = VT + IListBox1.Items.Add(PROD.Text)VTOTAL.Text = VTIVA.Text = ITOTAL.Text = T

End Sub

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click

ListBox1.Items.Clear()VTOTAL.Text = ""IVA.Text = ""TOTAL.Text = ""CANT.Text = ""VUNI.Text = ""PROD.Text = ""PROD.Focus()

End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

Form1.Close()End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

fORM4.SHOW()Me.Hide()

End SubEnd Class

Leonel Navarrete

MouseMove

Public Class Form4

Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove

RESP.Text = "MONITOR"End SubPrivate Sub PictureBox2_MouseMove(ByVal sender As Object, ByVal e As

System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseMoveRESP.Text = "TECLADO"

End SubPrivate Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles PictureBox3.ClickEnd SubPrivate Sub PictureBox3_MouseMove(ByVal sender As Object, ByVal e As

System.Windows.Forms.MouseEventArgs) Handles PictureBox3.MouseMoveRESP.Text = "RATÓN"

End SubPrivate Sub PictureBox4_MouseMove(ByVal sender As Object, ByVal e As

System.Windows.Forms.MouseEventArgs) Handles PictureBox4.MouseMoveRESP.Text = "CPU"

End SubPrivate Sub Button10_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button10.ClickRESP.Text = ""

End SubPrivate Sub Button8_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button8.ClickForm1.Close()

End SubPrivate Sub Button9_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button9.ClickForm5.Show()Me.Hide()

End SubEnd Class

Leonel Navarrete

Public Class Form5Private Sub Button1_Click(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles Button1.ClickTextBox1.ForeColor = Color.Red

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button2.Click

Me.BackColor = Color.BlackEnd Sub

Private Sub Button10_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button10.Click

Me.BackColor = Color.WhiteTextBox1.ForeColor = Color.BlackTextBox1.Text = ""TextBox1.Focus()

End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button8.Click

Form1.Close()End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button9.Click

Form1.Show()Me.Hide()

End SubEnd Class

Leonel Navarrete

Tiempo del día

Public Class Form1

Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton1.Click

Dim H As IntegerH = TextBox2.TextSelect Case H

Case 1 To 5MsgBox("MADRUGADA")

Case 6 To 11MsgBox("MAÑANA")

Case 12 To 18MsgBox("TARDE")

Case 19 To 24MsgBox("NOCHE")

End Select

End SubEnd Class

Leonel Navarrete

Día del Año, con BISIESTO

Public Class Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim año, mes, dia, a, bisiesto As Integer

año = Mid(TextBox1.Text, 1, 4)mes = Mid(TextBox1.Text, 6, 2)a = Mid(TextBox1.Text, 9, 2)bisiesto = año Mod 4If año < 1900 Or año > 2014 Then

MsgBox("INGRESE OTRO AÑO")Else

If mes <= 0 Or mes > 12 ThenMsgBox("INGRESE OTRO MES")

ElseSelect Case mes

Case 1, 3, 5, 7, 8, 10, 12dia = 31

Case 4, 6, 9, 11dia = 30

Case 2If bisiesto = 0 Then

dia = 29Else

dia = 28End If

End SelectIf a > dia Then

MsgBox("Ingrese otro dia")Else

MsgBox("Fecha valida")End If

End IfEnd If

End SubEnd Class

Leonel Navarrete

Bucle For

Public Class Form1

Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton1.Click

Dim resp As IntegerDim I As IntegerDim R As IntegerR = Val(TextBox1.Text)For I = 1 To 10 Step 1

resp = I * RListBox1.Items.Add(I & " * " & R & " = "

& resp)Next

End SubEnd Class

Leonel Navarrete

Bucle For

Public Class Form2

Private Sub Button1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesButton1.Click

Dim I As Integer

For I = 2 To 100 Step 2ListBox1.Items.Add(I)

NextEnd Sub

End Class

Leonel Navarrete

Public Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button1.ClickIf CheckBox1.Checked = True Then

TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)End IfIf CheckBox2.Checked = True Then

TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)End IfIf CheckBox3.Checked = True Then

TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)End IfIf CheckBox4.Checked = True Then

TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)End IfCheckBox1.Checked = FalseCheckBox2.Checked = FalseCheckBox3.Checked = FalseCheckBox4.Checked = False

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

EndEnd Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button3.Click

FORM2.SHOW()Me.Hide()

End SubEnd Class

Leonel Navarrete

Public Class Form2Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChangedIf ComboBox1.SelectedItem = "Disponible" Then

PictureBox1.Visible = TruePictureBox2.Visible = FalsePictureBox3.Visible = FalsePictureBox4.Visible = False

End IfIf ComboBox1.SelectedItem = "Ausente" Then

PictureBox3.Visible = TruePictureBox2.Visible = FalsePictureBox1.Visible = FalsePictureBox4.Visible = False

End IfIf ComboBox1.SelectedItem = "Ocupado" Then

PictureBox2.Visible = TruePictureBox1.Visible = FalsePictureBox3.Visible = FalsePictureBox4.Visible = False

End IfIf ComboBox1.SelectedItem = "Otros" Then

PictureBox4.Visible = TruePictureBox2.Visible = FalsePictureBox3.Visible = FalsePictureBox1.Visible = False

End IfEnd Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

EndEnd Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

Form3.Show()Me.Hide()

End SubEnd Class

Leonel Navarrete

Public Class Form3

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim r As Integerr = Val(TextBox1.Text) Mod 2If r = 0 Then

TextBox2.Text = "NÚMERO PAR"Else

TextBox2.Text = "NÚMERO IMPAR"End If

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

EndEnd Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

TextBox1.Text = ""TextBox2.Text = ""

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Form4.Show()Me.Hide()

End SubEnd Class

Leonel Navarrete

Public Class Form4

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim A, B, C As DoubleA = Val(TextBox1.Text)B = Val(TextBox2.Text)C = Val(TextBox3.Text)

If A > B And A > C ThenTextBox4.Text = "EL MAYOR ES: " & A

ElseIf B > A And B > C ThenTextBox4.Text = "EL MAYOR ES: " & B

ElseIf C > B And C > A ThenTextBox4.Text = "EL MAYOR ES: " & C

End IfEnd Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

TextBox1.Text = ""TextBox2.Text = ""TextBox3.Text = ""TextBox4.Text = ""TextBox1.Focus()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button3.Click

Form5.Show()Me.Hide()

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button4.Click

EndEnd Sub

End Class

Leonel Navarrete

Public Class Form5

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim N1, N2, P As DoubleN1 = Val(TextBox1.Text)N2 = Val(TextBox2.Text)P = (N1 + N2) / 2TextBox3.Text = PIf P >= 19 Then

TextBox4.Text = "A"ElseIf P >= 16 Then

TextBox4.Text = "B"ElseIf P >= 14 Then

TextBox4.Text = "C"ElseIf P >= 12 Then

TextBox4.Text = "D"Else

TextBox4.Text = "E"End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

Form6.Show()Me.Hide()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button3.Click

EndEnd Sub

End Class

Leonel Navarrete

Leonel Navarrete

Public Class Form7Dim mensual As Double

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim sueldo, sueldo1 As DoubleDim año As IntegerDim nombre As Stringmensual = 40000 / 12año = Val(TextBox3.Text)nombre = TextBox1.Text

If año > 10 Thensueldo1 = mensual * 0.1

ElseIf año >= 5 Thensueldo1 = mensual * 0.07

ElseIf año >= 3 Thensueldo1 = mensual * 0.05

Elsesueldo1 = mensual * 0.03

End IfTextBox5.Text = sueldo1

If año >= 10 Thensueldo = mensual + (mensual * 0.1)

ElseIf año >= 5 Thensueldo = mensual + (mensual * 0.07)

ElseIf año >= 3 Thensueldo = mensual + (mensual * 0.05)

Elsesueldo = mensual + (mensual * 0.03)

End IfTextBox2.Text = mensualTextBox4.Text = nombre & " " & " recibe: $" & sueldo

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 = ""TextBox5.Text = ""TextBox1.Focus()

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

EndEnd Sub

Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

mensual = 40000 / 12TextBox2.Text = mensualTextBox6.Text = Date.Now

End SubEnd Class

Leonel Navarrete

Public Class Form6

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim num As Doublenum = Val(TextBox1.Text)If num = 0 Then

TextBox2.Text = "Ingrese un Número Diferente de Cero"TextBox1.Text = ""TextBox2.Text = ""TextBox1.Focus()

End If

If num < 0 ThenTextBox2.Text = "EL NÚMERO ES NEGATIVO"

ElseTextBox2.Text = "EL NÚMERO ES POSITIVO"

End If

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button4.Click

EndEnd Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button3.Click

Form7.Show()Me.Hide()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

TextBox1.Text = ""TextBox2.Text = ""TextBox1.Focus()

End SubEnd Class

Leonel Navarrete

Serie Fibonacci

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button1.Click

Dim N, f1, f2, s As Integer

N = Val(TextBox1.Text)f1 = 0f2 = 1

For I = 1 To N Step 1f1 = f2f2 = sTextBox2.Text = TextBox2.Text & " " & sListBox1.Items.Add(TextBox2.Text)s = f1 + f2

Next

End SubEnd Class

Leonel Navarrete

Verificar Cédula - Ecuador

Leonel Navarrete

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim prov As IntegerDim par1, par2, par3, par4, pars As IntegerDim im1, im2, im3, im4, im5, ims As IntegerDim ced, ced1, ced2, n10, nt As Integer

'Validación Ingresont = Len(TextBox1.Text)If nt > 10 Or nt < 10 Then

MsgBox("CÉDULA INCORRECTA")TextBox1.Text = ""TextBox1.Focus()

Else

'provinciaprov = Mid(TextBox1.Text, 1, 2)'número de validaciónn10 = Mid(TextBox1.Text, 10, 1)

'------------------cédula----------------------'parespar1 = Mid(TextBox1.Text, 2, 1)par2 = Mid(TextBox1.Text, 4, 1)par3 = Mid(TextBox1.Text, 6, 1)par4 = Mid(TextBox1.Text, 8, 1)'sumapars = Val(par1) + Val(par2) + Val(par3) + Val(par4)

'******************************************'imparesim1 = Mid(TextBox1.Text, 1, 1) * 2If im1 > 9 Then im1 = im1 - 9im2 = Mid(TextBox1.Text, 3, 1) * 2If im2 > 9 Then im2 = im2 - 9im3 = Mid(TextBox1.Text, 5, 1) * 2If im3 > 9 Then im3 = im3 - 9im4 = Mid(TextBox1.Text, 7, 1) * 2If im4 > 9 Then im4 = im4 - 9im5 = Mid(TextBox1.Text, 9, 1) * 2If im5 > 9 Then im5 = im5 - 9'sumaims = Val(im1) + Val(im2) + Val(im3) + Val(im4) + Val(im5)

'*******************************************

'validacion último númeroced = ims + parsced1 = Mid(ced, 1, 1) + 1ced2 = ced1 * 10ced = ced2 - ced

If ced = n10 ThenMsgBox("Cédula Válida")

'*******************************************

Leonel Navarrete

'CODIGO DE PROVINCIASIf 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"

ElseMsgBox("Cédula no Valida")TextBox1.Text = ""TextBox1.Focus()

End IfEnd If

End SubEnd Class

Leonel Navarrete

Número Primo

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim N, primo As DoubleN = Val(TextBox1.Text)For i = 1 To N Step 1

If N Mod i = 0 Thenprimo += 1

End IfNextIf primo = 2 Then

MsgBox(N & " es Primo")TextBox1.Text = ""TextBox1.Focus()

ElseMsgBox(N & " No es Primo")TextBox1.Text = ""TextBox1.Focus()

End IfEnd Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

EndEnd Sub

End Class

Leonel Navarrete

Contador de Vocales

Leonel Navarrete

Public Class Form1Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles CheckBox1.CheckedChangedDim t As StringDim cont As Integert = TextBox1.Textcont = 0For i = 1 To Len(t) Step 1

If Mid(TextBox1.Text, i, 1) = "a" Or Mid(TextBox1.Text, i, 1) = "A"Then

cont = cont + 1End If

NextTextBox2.Text = cont

End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged

Dim t As StringDim cont As Integert = TextBox1.Textcont = 0For i = 1 To Len(t) Step 1

If Mid(TextBox1.Text, i, 1) = "e" Or Mid(TextBox1.Text, i, 1) = "E"Then

cont = cont + 1End If

NextTextBox2.Text = cont

End Sub

Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged

Dim t As StringDim cont As Integert = TextBox1.Textcont = 0For i = 1 To Len(t) Step 1

If Mid(TextBox1.Text, i, 1) = "i" Or Mid(TextBox1.Text, i, 1) = "I"Then

cont = cont + 1End If

NextTextBox2.Text = cont

End Sub

Leonel Navarrete

Private Sub CheckBox4_CheckedChanged(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesCheckBox4.CheckedChanged

Dim t As StringDim cont As Integert = TextBox1.Textcont = 0For i = 1 To Len(t) Step 1

If Mid(TextBox1.Text, i, 1) = "o" OrMid(TextBox1.Text, i, 1) = "O" Then

cont = cont + 1End If

NextTextBox2.Text = cont

End Sub

Private Sub CheckBox5_CheckedChanged(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) HandlesCheckBox5.CheckedChanged

Dim t As StringDim cont As Integert = TextBox1.Textcont = 0For i = 1 To Len(t) Step 1

If Mid(TextBox1.Text, i, 1) = "u" OrMid(TextBox1.Text, i, 1) = "U" Then

cont = cont + 1End If

NextTextBox2.Text = cont

End SubEnd Class

Leonel Navarrete

For each

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVale 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 IfNext

End SubEnd Class

Leonel Navarrete

Vectores contar cuántos pares - impares

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim numeros, par, impar As IntegerFor I = 1 To 5 Step 1

numeros = InputBox("Ingrese Valores", Title:="Calcular cuantos pares e impares")

If numeros Mod 2 = 0 Thenpar = par + 1 'contador

Elseimpar = impar + 1 'contador

End IfNextTextBox1.Text = "Pares = " & parTextBox2.Text = "Impares = " & impar

End SubEnd Class

Leonel Navarrete

Vectores sumar pares - impares

Public Class Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim numeros, par, impar As IntegerFor I = 1 To 5 Step 1

numeros = InputBox("Ingrese Valores Pares e Impares", Title:="Suma de Pares E Impares")

If numeros Mod 2 = 0 Thenpar += Val(numeros) 'contador

Elseimpar += Val(numeros) 'contador

End IfNextTextBox1.Text = "Pares = " & parTextBox2.Text = "Impares = " & impar

End SubEnd Class

Leonel Navarrete

Vectores sumar valores

Public Class Suma_de_Valores

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim numeros, suma As IntegerFor I = 1 To 5 Step 1

numeros = InputBox("Ingrese Valores Pares e Impares", Title:="Suma Total")

suma += numerosNextTextBox1.Text = "Suma = " & suma

End SubEnd Class

Leonel Navarrete

Matrices

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim f1, c1, f2, c2, cont As Integer

'ingrese valores de matricesf1 = InputBox("Ingrese Fila Matriz 1")c1 = InputBox("Ingrese Columna Matriz 1")f2 = InputBox("Ingrese Fila Matriz 2")c2 = InputBox("Ingrese Columna Matriz 2")Dim mat1(f1, c1), mat2(f2, c2), matp(f1, c2) As Integer

If c1 = f2 Then'matriz 1For i = 1 To f1

For j = 1 To c1mat1(i, j) = InputBox("Ingrese Valores Matriz 1")ListBox1.Items.Add(mat1(i, j))

NextNext

'matriz 2For i = 1 To f2

For j = 1 To c2mat2(i, j) = InputBox("Ingrese Matriz 2")ListBox2.Items.Add(mat2(i, j))

NextNext

'productoFor i = 1 To f1

For j = 1 To c2For kf = 1 To c1

cont = mat1(i, kf) * mat2(kf, j) + contNextmatp(i, j) = contListBox3.Items.Add(matp(i, j))cont = 0

NextNext

ElseMsgBox("Error")End

End If

End SubEnd Class

Leonel Navarrete

Matrices

Public Class Suma_Matrices

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim f1, c1, f2, c2, cont As Integer'ingrese valores de matricesf1 = InputBox("Ingrese Fila Matriz 1")c1 = InputBox("Ingrese Columna Matriz 1")f2 = InputBox("Ingrese Fila Matriz 2")c2 = InputBox("Ingrese Columna Matriz 2")Dim mat1(f1, c1), mat2(f2, c2), matp(f1, c1) As IntegerIf f1 = f2 And c1 = c2 Then

'matriz 1For i = 1 To f1

For j = 1 To c1mat1(i, j) = InputBox("Ingrese Valores Matriz 1")ListBox1.Items.Add(mat1(i, j))

NextNext'matriz 2For i = 1 To f2

For j = 1 To c2mat2(i, j) = InputBox("Ingrese Matriz 2")ListBox2.Items.Add(mat2(i, j))

NextNext'suma'para le resta cambiamos el signo "+"For i = 1 To f1

For j = 1 To c1cont = mat1(i, j) + mat2(i, j)matp(i, j) = contListBox3.Items.Add(matp(i, j))

Nextcont = 0

NextElse

MsgBox("Matrices no iguales")End If

End SubEnd Class

Leonel Navarrete

Aplicación

Leonel Navarrete

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

Dim cuanto, par, impar, num, mayor, mayors, d As Integer

cuanto = Len(TextBox1.Text)TextBox2.Text = cuanto

For i = 1 To cuanto Step 1num = Mid(Val(TextBox1.Text), i, 1)If num Mod (2) = 0 Then

par = num + parElse

impar = num + imparEnd If

NextTextBox3.Text = parTextBox4.Text = imparTextBox5.Text = par + impar

'mayor

For i = 1 To cuantomayor = Mid(TextBox1.Text, i, 1)If mayor > mayors Then

mayors = Mid(TextBox1.Text, i, 1)mayors = mayor

End IfNextTextBox6.Text = mayors'menorFor i = 1 To cuanto

mayor = Mid(TextBox1.Text, i, 1)If mayor < mayors Then

mayors = Mid(TextBox1.Text, i, 1)mayors = mayor

End IfNextTextBox7.Text = mayors

'divisoresFor i = 1 To Val(TextBox1.Text) Step 1

d = Val(TextBox1.Text) Mod iIf d = 0 Then

ListBox1.Items.Add(i)End If

NextEnd Sub

Leonel Navarrete

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim cuanto, par, impar, num, whi1, mayor, mayors, mayorss, d, d1 As Integer

cuanto = Len(TextBox1.Text)TextBox2.Text = cuantoWhile whi1 < cuanto

whi1 += 1

num = Mid(Val(TextBox1.Text), whi1, 1)If num Mod (2) = 0 Then

par = num + parElse

impar = num + imparEnd If

End WhileTextBox3.Text = parTextBox4.Text = imparTextBox5.Text = par + impar

'mayor

While mayor < cuantomayor += 1mayors = Mid(TextBox1.Text, mayor, 1)If mayors > mayorss Then

mayorss = Mid(TextBox1.Text, mayor, 1)mayorss = mayors

End IfEnd WhileTextBox6.Text = mayorss'menormayor = 0While mayor < cuanto

mayor += 1mayors = Mid(TextBox1.Text, mayor, 1)If mayors < mayorss Then

mayorss = Mid(TextBox1.Text, mayor, 1)mayorss = mayors

End IfEnd WhileTextBox7.Text = mayorss

'divisoresWhile d1 <= Val(TextBox1.Text)

d1 += 1d = Val(TextBox1.Text) Mod d1If d = 0 Then

ListBox1.Items.Add(d1)End If

End While

End Sub

Leonel Navarrete

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button3.Click

Dim cuanto, par, impar, num, whi1, mayor, mayors, mayorss, d, d1 AsInteger

cuanto = Len(TextBox1.Text)TextBox2.Text = cuantoDo

whi1 += 1num = Mid(Val(TextBox1.Text), whi1, 1)If num Mod (2) = 0 Then

par = num + parElse

impar = num + imparEnd If

Loop Until whi1 >= cuantoTextBox3.Text = parTextBox4.Text = imparTextBox5.Text = par + impar

'mayorDo

mayor += 1mayors = Mid(TextBox1.Text, mayor, 1)If mayors > mayorss Then

mayorss = Mid(TextBox1.Text, mayor, 1)mayorss = mayors

End IfLoop Until mayor >= cuantoTextBox6.Text = mayorss

'menormayor = 0Do

mayor += 1mayors = Mid(TextBox1.Text, mayor, 1)If mayors < mayorss Then

mayorss = Mid(TextBox1.Text, mayor, 1)mayorss = mayors

End IfLoop Until mayor >= cuantoTextBox7.Text = mayorss'divisoresDo

d1 += 1d = Val(TextBox1.Text) Mod d1If d = 0 Then

ListBox1.Items.Add(d1)End If

Loop Until d1 >= Val(TextBox1.Text)

End Sub

Leonel Navarrete

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton4.Click

Dim cuanto, par, impar, num, whi1, mayor, mayors, mayorss, d, d1 As Integer

cuanto = Len(TextBox1.Text)TextBox2.Text = cuantoDo While whi1 < cuanto

whi1 += 1num = Mid(Val(TextBox1.Text), whi1, 1)If num Mod (2) = 0 Then

par = num + parElse

impar = num + imparEnd If

LoopTextBox3.Text = parTextBox4.Text = imparTextBox5.Text = par + impar

'mayor

Do While mayor < cuantomayor += 1mayors = Mid(TextBox1.Text, mayor, 1)If mayors > mayorss Then

mayorss = Mid(TextBox1.Text, mayor, 1)mayorss = mayors

End IfLoopTextBox6.Text = mayorss'menormayor = 0Do While mayor < cuanto

mayor += 1mayors = Mid(TextBox1.Text, mayor, 1)If mayors < mayorss Then

mayorss = Mid(TextBox1.Text, mayor, 1)mayorss = mayors

End IfLoopTextBox7.Text = mayorss'divisoresDo While d1 <= Val(TextBox1.Text)

d1 += 1d = Val(TextBox1.Text) Mod d1If d = 0 Then

ListBox1.Items.Add(d1)End If

Loop

End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click'LimpiarTextBox1.Text = ""TextBox2.Text = ""TextBox3.Text = ""TextBox4.Text = ""TextBox5.Text = ""TextBox6.Text = ""TextBox7.Text = ""ListBox1.Items.Clear()TextBox1.Focus()

End SubEnd Class

Leonel Navarrete

TABLAS DE MULTIPLICAR

Leonel Navarrete

Public Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button1.ClickDim n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12 As IntegerDim tab1, tab2, tab3, tab4, tab5, tab6, tab7, tab8, tab9, tab10, tab11,

tab12 As IntegerWhile n1 <= 10

ListBox1.Items.Add(n1.ToString & " * 1" & "= " & tab1)n1 += 1tab1 = n1 * 1ListBox2.Items.Add(n2.ToString & " * 2" & "= " & tab2)n2 += 1tab2 = n1 * 2ListBox3.Items.Add(n3.ToString & " * 3" & "= " & tab3)n3 += 1tab3 = n3 * 3ListBox4.Items.Add(n4.ToString & " * 4" & "= " & tab4)n4 += 1tab4 = n4 * 4ListBox5.Items.Add(n5.ToString & " * 5" & "= " & tab5)n5 += 1tab5 = n5 * 5ListBox6.Items.Add(n6.ToString & " * 6" & "= " & tab6)n6 += 1tab6 = n6 * 6ListBox7.Items.Add(n7.ToString & " * 7" & "= " & tab7)n7 += 1tab7 = n7 * 7ListBox8.Items.Add(n8.ToString & " * 8" & "= " & tab8)n8 += 1tab8 = n8 * 8ListBox9.Items.Add(n9.ToString & " * 9" & "= " & tab9)n9 += 1tab9 = n9 * 9ListBox10.Items.Add(n10.ToString & " * 10" & "= " & tab10)n10 += 1tab10 = n10 * 10ListBox11.Items.Add(n11.ToString & " * 11" & "= " & tab11)n11 += 1tab11 = n11 * 11ListBox12.Items.Add(n12.ToString & " * 12" & "= " & tab12)n12 += 1tab12 = n12 * 12

End WhileEnd Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

EndEnd Sub

End Class

Leonel Navarrete

Vector n posiciones

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button1.Click

Dim n1, n2, n3 As Integern1 = InputBox("Ingrese 1° Vector")Dim vec(n1) As IntegerFor i = 1 To n1

vec(i) = InputBox("Ingrese Valor " & i)ListBox1.Items.Add(vec(i))

Next

n2 = InputBox("Ingrese redimensión")If n2 > n1 Then

ReDim Preserve vec(n2)For i = n1 + 1 To n2

vec(i) = InputBox("Ingrese Valores redimension a partir de " & n1)

NextFor i = 1 To n2

ListBox2.Items.Add(vec(i))Next

ElseMsgBox("ingrese numero mayor que vector 1")End

End If

End SubEnd Class

Leonel Navarrete

While – Do – Do While

Public Class Form1Dim x As IntegerPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles Button1.Clickx = 0While x <= 10

TextBox1.Text &= x.ToString & " "x += 1

End WhileEnd Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button3.Click

x = 0Do While x <= 10

TextBox3.Text &= x.ToString & " "x += 1

LoopEnd Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button2.Click

x = 0Do

TextBox2.Text &= x.ToString & " "x += 1

Loop Until x > 10End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles Button4.Click

EndEnd Sub

End Class

Leonel Navarrete

Suma de Vectores

Public Class Suma_y_Resta_de_Vectores

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click

ListBox1.Items.Clear()ListBox2.Items.Clear()ListBox3.Items.Clear()Dim f1, f2, f3 As Integer

'ingrese magnitud vectorf1 = InputBox("Ingrese el límite 1º vector")f2 = InputBox("Ingrese el límite 2º vector")f3 = f1If f1 = f2 Then

Dim v1(f1), v2(f2), vs(f1)

'ingrese vector 1For i = 1 To f1

v1(i) = InputBox("INGRESE VECTOR DE POSICIÓN: " & i)ListBox1.Items.Add(v1(i))

Next

'ingreso vector 2For i = 1 To f2

v2(i) = InputBox("INGRESE VECTOR DE POSICIÓN: " & i)ListBox2.Items.Add(v2(i))

Next

'suma vectoresFor i = 1 To f3

vs(i) = Val(v1(i)) + Val(v2(i))ListBox3.Items.Add(vs(i))

NextElse

MsgBox("Vectores desiguales")End If

End Sub

Leonel Navarrete

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

ListBox1.Items.Clear()ListBox2.Items.Clear()ListBox3.Items.Clear()Dim f1, f2, f3 As Integer

'ingrese magnitud vectorf1 = InputBox("Ingrese el límite 1º vector")f2 = InputBox("Ingrese el límite 2º vector")f3 = f1If f1 = f2 Then

Dim v1(f1), v2(f2), vs(f1)

'ingrese vector 1For i = 1 To f1

v1(i) = InputBox("INGRESE VECTOR DE POSICIÓN: " & i)ListBox1.Items.Add(v1(i))

Next

'ingreso vector 2For i = 1 To f2

v2(i) = InputBox("INGRESE VECTOR DE POSICIÓN: " & i)ListBox2.Items.Add(v2(i))

Next

'resta vectoresFor i = 1 To f3

vs(i) = Val(v1(i)) - Val(v2(i))ListBox3.Items.Add(vs(i))

NextElse

MsgBox("Vectores desiguales")End If

End SubEnd Class