Programación .Net

Page 1

NAVARRETE MONTENEGRO ERIK LEONEL Leonel Navarrete


Uni贸n de Caracteres

Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim texto1, texto2 As String texto1 = TextBox1.Text texto2 = TextBox2.Text TextBox3.Text = texto1 + texto2 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim texto1, texto2 As String texto1 = TextBox1.Text texto2 = TextBox2.Text TextBox4.Text = texto1 & texto2 End Sub End Class Leonel Navarrete


Manipular caracteres con MID Dise帽o

Ejecuci贸n

Programaci贸n

Leonel Navarrete


Manipular caracteres con LEN Dise帽o

Ejecuci贸n

Programaci贸n

Leonel Navarrete


Manipular caracteres con LEFT Dise帽o

Ejecuci贸n

Programaci贸n

Leonel Navarrete


Manipular caracteres con RIGHT Dise帽o

Ejecuci贸n

Programaci贸n

Leonel Navarrete


Manipular caracteres con SPACE Dise帽o

Ejecuci贸n

Programaci贸n

Leonel Navarrete


Manipular caracteres con TRIM Dise帽o

Ejecuci贸n

Programaci贸n

Leonel Navarrete


Enlazar Formularios

Programaci贸n Form 1

Leonel Navarrete


Enlazar Formularios

Programaci贸n Form 2

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


Select Case

Con MSGBOX

MsgBox

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


Funciones Y Procedimientos

ANIMACIĂ“N DE LETRAS

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.Crimson 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.Blue End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End 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) Handles Button2.MouseMove Me.BackColor = Color.Gold End Sub

Private Sub Button3_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.DoubleClick Me.BackColor = Color.Cyan End Sub End Class

Leonel Navarrete


Propiedades de los objetos

Public Class Form3 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

Leonel Navarrete


Propiedades de los objetos

Public Class Form4 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick TextBox1.Text = Date.Now TextBox2.Text = TimeOfDay End Sub End Class

Leonel Navarrete


Propiedades de los objetos

Public Class Form5 Private Sub cambiar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cambiar.Click nombre.Text = "Programación“ End Sub End Class

Leonel Navarrete


Propiedades de los objetos

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

Leonel Navarrete


Propiedades de los objetos

Public Class Form7 Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged TextBox1.Text = "Programación" End Sub Private Sub CheckBox2_CheckedChanged(ByVal sender As 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 As System.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 As System.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 As System.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 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 Button5_Click(ByVal sender As System.Object, ByVal e As System.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 As System.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 As System.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 As System.EventArgs) Handles Button5.Click End End Sub End Class Leonel Navarrete


Utilizando un M贸dulo Module Module1 Public Contador As Integer = 0 Public u, c, d As Object Public Sub animacion() If Contador = 3 Then Contador = 0 Else Contador = Contador + 1 Select Case Contador Case 1 u.Visible = True c.Visible = False d.Visible = False Case 2 u.Visible = False c.Visible = True d.Visible = False Case 3 u.Visible = False c.Visible = False d.Visible = True End Select End If End Sub End Module

Leonel Navarrete


Utilizando un M贸dulo

Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load u = Label1() c = Label2() d = Label3 Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick animacion() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "Leo" And Val(TextBox2.Text) = 123 Then Timer2.Start() Else MsgBox("Usuario o contrase帽a incorrecto", MsgBoxStyle.Critical) End If End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick ProgressBar1.Increment(1) If ProgressBar1.Value = 100 Then Me.Hide() Form2.Show() Timer2.Stop() End If End Sub End Class Leonel Navarrete


Utilizando un Mรณdulo

Public Class Form2 Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load u = Label1() c = Label2() d = Label3 Timer1.Start() End Sub Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click End End Sub Private Sub CuadradoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CuadradoToolStripMenuItem.Click Me.Hide() Form3.Show() End Sub Private Sub RectรกnguloToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RectรกnguloToolStripMenuItem.Click Me.Hide() Form5.Show() End Sub Private Sub TriรกnguloToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.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 Sub Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove u = 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 As System.Object, ByVal e As System.EventArgs) Handles Menú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 End End Sub Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load u = Label1() c = Label2() d = Label3 Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick animacion() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label7.Text = Val(TextBox1.Text) * 4 Label8.Text = Val(TextBox1.Text) * Val(TextBox1.Text) End Sub End Class Leonel Navarrete


Utilizando un Módulo

Public Class Form4 Private Sub MenúPrincipalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Menú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 End End Sub Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load u = Label1() c = Label2() d = Label3 Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) animacion() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label7.Text = Val(TextBox1.Text) * 2 + Val(TextBox2.Text) * 2 Label8.Text = Val(TextBox1.Text) * Val(TextBox2.Text) End Sub End Class Leonel Navarrete


Utilizando un Módulo

Public Class Form5 Private Sub MenúPrincipalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Menú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 End End Sub Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load u = Label1() c = Label2() d = Label3 Timer1.Start() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.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 Sub End Class Leonel Navarrete


Aplicaci贸n 1

Leonel Navarrete


Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.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 As System.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 As System.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 As System.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 As System.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 As System.EventArgs) Handles Button6.Click N3.Text = Val(N1.Text) ^ Val(N2.Text) End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click N3.Text = Val(N1.Text) Mod Val(N2.Text) End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click N1.Text = "" N2.Text = "" N3.Text = "" N1.Focus() End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click Me.Close() End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click Me.Hide() Form2.show() End Sub End Class Leonel Navarrete


Boolean

Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim A As Integer Dim RES As Boolean A = TextBox1.Text RES = Not (A + 10 < 20) MsgBox(RES) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class Leonel Navarrete


Public Class Form2 Private Sub salario_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles salario.Click Dim SB, HT, PPH, D, SN As Double HT = Val(HORAST.Text) PPH = Val(PAGOH.Text) SB = HT * PPH D = SB * 0.2 SN = SB - D SALARION.Text = SN End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.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 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 Form3.Show() Me.Hide() End Sub End 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, T C = Val(CANT.Text) V = Val(VUNI.Text) VT = C * V I = VT * 0.12 T = VT + I ListBox1.Items.Add(PROD.Text) VTOTAL.Text = VT IVA.Text = I TOTAL.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 Sub End Class Leonel Navarrete


MouseMove

Public Class Form4 Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove RESP.Text = "MONITOR" End Sub Private Sub PictureBox2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseMove RESP.Text = "TECLADO" End Sub Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click End Sub Private Sub PictureBox3_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox3.MouseMove RESP.Text = "RATĂ“N" End Sub Private Sub PictureBox4_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox4.MouseMove RESP.Text = "CPU" End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click RESP.Text = "" 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 Form5.Show() Me.Hide() End Sub End Class Leonel Navarrete


Public Class Form5 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.ForeColor = Color.Red End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.BackColor = Color.Black End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click Me.BackColor = Color.White TextBox1.ForeColor = Color.Black TextBox1.Text = "" TextBox1.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 Form1.Show() Me.Hide() End Sub End Class Leonel Navarrete


Tiempo del día

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim H As Integer H = TextBox2.Text Select Case H Case 1 To 5 MsgBox("MADRUGADA") Case 6 To 11 MsgBox("MAÑANA") Case 12 To 18 MsgBox("TARDE") Case 19 To 24 MsgBox("NOCHE") End Select

End Sub End Class Leonel Navarrete


Día del Año, con BISIESTO

Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.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 4 If año < 1900 Or año > 2014 Then MsgBox("INGRESE OTRO AÑO") Else If mes <= 0 Or mes > 12 Then MsgBox("INGRESE OTRO MES") Else Select Case mes Case 1, 3, 5, 7, 8, 10, 12 dia = 31 Case 4, 6, 9, 11 dia = 30 Case 2 If bisiesto = 0 Then dia = 29 Else dia = 28 End If End Select If a > dia Then MsgBox("Ingrese otro dia") Else MsgBox("Fecha valida") End If End If End If End Sub End Class

Leonel Navarrete


Bucle For

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim resp As Integer Dim I As Integer Dim R As Integer R = Val(TextBox1.Text) For I = 1 To 10 Step 1 resp = I * R ListBox1.Items.Add(I & " * " & R & " = " & resp) Next End Sub End Class Leonel Navarrete


Bucle For

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

Leonel Navarrete


Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If CheckBox1.Checked = True Then TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text) End If If CheckBox2.Checked = True Then TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text) End If If CheckBox3.Checked = True Then TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text) End If If CheckBox4.Checked = True Then TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text) End If CheckBox1.Checked = False CheckBox2.Checked = False CheckBox3.Checked = False CheckBox4.Checked = False End Sub 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 FORM2.SHOW() Me.Hide() End Sub End Class

Leonel Navarrete


Public Class Form2 Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged If ComboBox1.SelectedItem = "Disponible" Then PictureBox1.Visible = True PictureBox2.Visible = False PictureBox3.Visible = False PictureBox4.Visible = False End If If ComboBox1.SelectedItem = "Ausente" Then PictureBox3.Visible = True PictureBox2.Visible = False PictureBox1.Visible = False PictureBox4.Visible = False End If If ComboBox1.SelectedItem = "Ocupado" Then PictureBox2.Visible = True PictureBox1.Visible = False PictureBox3.Visible = False PictureBox4.Visible = False End If If ComboBox1.SelectedItem = "Otros" Then PictureBox4.Visible = True PictureBox2.Visible = False PictureBox3.Visible = False PictureBox1.Visible = False End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Form3.Show() Me.Hide() End Sub End 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 Integer r = Val(TextBox1.Text) Mod 2 If 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 End End 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 Sub End Class Leonel Navarrete


Public Class Form4 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim A, B, C As Double A = Val(TextBox1.Text) B = Val(TextBox2.Text) C = Val(TextBox3.Text) If A > B And A > C Then TextBox4.Text = "EL MAYOR ES: " & A ElseIf B > A And B > C Then TextBox4.Text = "EL MAYOR ES: " & B ElseIf C > B And C > A Then TextBox4.Text = "EL MAYOR ES: " & C End If 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 = "" TextBox1.Focus() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Form5.Show() Me.Hide() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click End End Sub End Class Leonel Navarrete


Public Class Form5 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim N1, N2, P As Double N1 = Val(TextBox1.Text) N2 = Val(TextBox2.Text) P = (N1 + N2) / 2 TextBox3.Text = P If 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 As System.EventArgs) Handles Button2.Click Form6.Show() Me.Hide() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class Leonel Navarrete


Leonel Navarrete


Public Class Form7 Dim mensual As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sueldo, sueldo1 As Double Dim año As Integer Dim nombre As String mensual = 40000 / 12 año = Val(TextBox3.Text) nombre = TextBox1.Text If año > 10 Then sueldo1 = mensual * ElseIf año >= 5 Then sueldo1 = mensual * ElseIf año >= 3 Then sueldo1 = mensual * Else sueldo1 = mensual * End If TextBox5.Text = sueldo1

0.1 0.07 0.05 0.03

If año >= 10 Then sueldo = mensual + (mensual ElseIf año >= 5 Then sueldo = mensual + (mensual ElseIf año >= 3 Then sueldo = mensual + (mensual Else sueldo = mensual + (mensual End If TextBox2.Text = mensual TextBox4.Text = nombre & " " & End Sub

* 0.1) * 0.07) * 0.05) * 0.03)

" recibe:

$" & sueldo

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

End End Sub Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load mensual = 40000 / 12 TextBox2.Text = mensual TextBox6.Text = Date.Now End Sub End Class

Leonel Navarrete


Public Class Form6 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim num As Double num = 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 Then TextBox2.Text = "EL NÚMERO ES NEGATIVO" Else TextBox2.Text = "EL NÚMERO ES POSITIVO" End If End Sub 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 Form7.Show() Me.Hide() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox1.Focus() End Sub End Class Leonel Navarrete


Serie Fibonacci

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim N, f1, f2, s As Integer N = Val(TextBox1.Text) f1 = 0 f2 = 1 For I = 1 To N Step 1 f1 = f2 f2 = s TextBox2.Text = TextBox2.Text & " " & s ListBox1.Items.Add(TextBox2.Text) s = f1 + f2 Next End Sub End Class Leonel Navarrete


Verificar CĂŠdula - Ecuador

Leonel Navarrete


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

Dim Dim Dim Dim

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

'Validación Ingreso nt = Len(TextBox1.Text) If nt > 10 Or nt < 10 Then MsgBox("CÉDULA INCORRECTA") TextBox1.Text = "" TextBox1.Focus() Else

'provincia prov = Mid(TextBox1.Text, 1, 2) 'número de validación n10 = Mid(TextBox1.Text, 10, 1) '------------------cédula---------------------'pares par1 = Mid(TextBox1.Text, 2, 1) par2 = Mid(TextBox1.Text, 4, 1) par3 = Mid(TextBox1.Text, 6, 1) par4 = Mid(TextBox1.Text, 8, 1) 'suma pars = Val(par1) + Val(par2) + Val(par3) + Val(par4) '****************************************** 'impares im1 = Mid(TextBox1.Text, 1, 1) * 2 If im1 > 9 Then im1 = im1 - 9 im2 = Mid(TextBox1.Text, 3, 1) * 2 If im2 > 9 Then im2 = im2 - 9 im3 = Mid(TextBox1.Text, 5, 1) * 2 If im3 > 9 Then im3 = im3 - 9 im4 = Mid(TextBox1.Text, 7, 1) * 2 If im4 > 9 Then im4 = im4 - 9 im5 = Mid(TextBox1.Text, 9, 1) * 2 If im5 > 9 Then im5 = im5 - 9 'suma ims = Val(im1) + Val(im2) + Val(im3) + Val(im4) + Val(im5) '******************************************* 'validacion último número ced = ims + pars ced1 = Mid(ced, 1, 1) + 1 ced2 = ced1 * 10 ced = ced2 - ced If ced = n10 Then MsgBox("Cédula Válida") '*******************************************

Leonel Navarrete


'CODIGO DE PROVINCIAS If prov = If prov = If prov = If prov = If prov = If prov = If prov = If prov = If prov = If prov = If prov = If prov = If prov = If prov = If prov = SANTIAGO" If prov = If prov = If prov = If prov = TUNGURAHUA" If prov = CHINCHIPE" If prov = If prov = If prov = If prov = Domingo de los Tsachilas" If prov = ELENA"

1 Then TextBox2.Text = " La Provincia es: AZUAY" 2 Then TextBox2.Text = " La Provincia es: BOLIVAR" 3 Then TextBox2.Text = " La Provincia es: CAÑAR" 4 Then TextBox2.Text = " La Provincia es: CARCHI" 4 Then TextBox2.Text = " La Provincia es: CARCHI" 5 Then TextBox2.Text = " La Provincia es: COTOPAXI" 6 Then TextBox2.Text = " La Provincia es: CHIMBORAZO" 7 Then TextBox2.Text = " La Provincia es: EL ORO" 8 Then TextBox2.Text = " La Provincia es: ESMERALDAS" 9 Then TextBox2.Text = " La Provincia es: GUAYAS" 10 Then TextBox2.Text = " La Provincia es: IMBABURA" 11 Then TextBox2.Text = " La Provincia es: LOJA" 12 Then TextBox2.Text = " La Provincia es: LOS RIOS" 13 Then TextBox2.Text = " La Provincia es: MANABÍ" 14 Then TextBox2.Text = " La Provincia es: MORONA

15 16 17 18

Then Then Then Then

TextBox2.Text TextBox2.Text TextBox2.Text TextBox2.Text

= = = =

" " " "

La La La La

Provincia Provincia Provincia Provincia

es: NAPO" es: PASTAZA" es: PICHINCHA" es:

19 Then TextBox2.Text = " La Provincia es: ZAMORA 20 21 22 23

Then Then Then Then

TextBox2.Text TextBox2.Text TextBox2.Text TextBox2.Text

= = = =

" " " "

La La La La

Provincia Provincia Provincia Provincia

es: es: es: es:

GALAPAGOS" SUCUMBIOS" ORELLANA" Santo

24 Then TextBox2.Text = " La Provincia es: SANTA

Else MsgBox("Cédula no Valida") TextBox1.Text = "" TextBox1.Focus() End If End If End Sub End Class

Leonel Navarrete


NĂşmero Primo

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim N, primo As Double N = Val(TextBox1.Text) For i = 1 To N Step 1 If N Mod i = 0 Then primo += 1 End If Next If primo = 2 Then MsgBox(N & " es Primo") TextBox1.Text = "" TextBox1.Focus() Else MsgBox(N & " No es Primo") TextBox1.Text = "" TextBox1.Focus() End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class

Leonel Navarrete


Contador de Vocales

Leonel Navarrete


Public Class Form1 Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged Dim t As String Dim cont As Integer t = TextBox1.Text cont = 0 For i = 1 To Len(t) Step 1 If Mid(TextBox1.Text, i, 1) = "a" Or Mid(TextBox1.Text, i, 1) = "A" Then cont = cont + 1 End If Next TextBox2.Text = cont End Sub Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged Dim t As String Dim cont As Integer t = TextBox1.Text cont = 0 For i = 1 To Len(t) Step 1 If Mid(TextBox1.Text, i, 1) = "e" Or Mid(TextBox1.Text, i, 1) = "E" Then cont = cont + 1 End If Next TextBox2.Text = cont End Sub Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged Dim t As String Dim cont As Integer t = TextBox1.Text cont = 0 For i = 1 To Len(t) Step 1 If Mid(TextBox1.Text, i, 1) = "i" Or Mid(TextBox1.Text, i, 1) = "I" Then cont = cont + 1 End If Next TextBox2.Text = cont End Sub

Leonel Navarrete


Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged Dim t As String Dim cont As Integer t = TextBox1.Text cont = 0 For i = 1 To Len(t) Step 1 If Mid(TextBox1.Text, i, 1) = "o" Or Mid(TextBox1.Text, i, 1) = "O" Then cont = cont + 1 End If Next TextBox2.Text = cont End Sub Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged Dim t As String Dim cont As Integer t = TextBox1.Text cont = 0 For i = 1 To Len(t) Step 1 If Mid(TextBox1.Text, i, 1) = "u" Or Mid(TextBox1.Text, i, 1) = "U" Then cont = cont + 1 End If Next TextBox2.Text = cont End Sub End Class

Leonel Navarrete


For each

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For Each dato As Control In Me.Controls 'sirve para todos los objetos del formulario 'If dato.GetType.ToString.Contains("Label") Then 'pinta todos los labels If dato.GetType.ToString.Contains("Button") Then 'pinta todos los butons dato.BackColor = Color.Aqua End If Next End Sub End 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 Integer For I = 1 To 5 Step 1 numeros = InputBox("Ingrese Valores", Title:="Calcular cuantos pares e impares") If numeros Mod 2 = 0 Then par = par + 1 'contador Else impar = impar + 1 'contador End If Next TextBox1.Text = "Pares = " & par TextBox2.Text = "Impares = " & impar End Sub End 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 Integer For I = 1 To 5 Step 1 numeros = InputBox("Ingrese Valores Pares e Impares", Title:="Suma de Pares E Impares") If numeros Mod 2 = 0 Then par += Val(numeros) 'contador Else impar += Val(numeros) 'contador End If Next TextBox1.Text = "Pares = " & par TextBox2.Text = "Impares = " & impar End Sub End 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 Integer For I = 1 To 5 Step 1 numeros = InputBox("Ingrese Valores Pares e Impares", Title:="Suma Total") suma += numeros Next TextBox1.Text = "Suma = " & suma

End Sub End 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 matrices f1 = 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 1 For i = 1 To f1 For j = 1 To c1 mat1(i, j) = InputBox("Ingrese Valores Matriz 1") ListBox1.Items.Add(mat1(i, j)) Next Next 'matriz 2 For i = 1 To f2 For j = 1 To c2 mat2(i, j) = InputBox("Ingrese Matriz 2") ListBox2.Items.Add(mat2(i, j)) Next Next 'producto For i = 1 To f1 For j = 1 To c2 For kf = 1 To c1 cont = mat1(i, kf) * mat2(kf, j) + cont Next matp(i, j) = cont ListBox3.Items.Add(matp(i, j)) cont = 0 Next Next Else MsgBox("Error") End End If End Sub End Class

Leonel Navarrete


Matrices

Public Class Suma_Matrices 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 matrices f1 = 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 Integer If f1 = f2 And c1 = c2 Then 'matriz 1 For i = 1 To f1 For j = 1 To c1 mat1(i, j) = InputBox("Ingrese Valores Matriz 1") ListBox1.Items.Add(mat1(i, j)) Next Next 'matriz 2 For i = 1 To f2 For j = 1 To c2 mat2(i, j) = InputBox("Ingrese Matriz 2") ListBox2.Items.Add(mat2(i, j)) Next Next 'suma 'para le resta cambiamos el signo "+" For i = 1 To f1 For j = 1 To c1 cont = mat1(i, j) + mat2(i, j) matp(i, j) = cont ListBox3.Items.Add(matp(i, j)) Next cont = 0 Next Else MsgBox("Matrices no iguales") End If End Sub End Class Leonel Navarrete


Aplicaci贸n

Leonel Navarrete


Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.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 1 num = Mid(Val(TextBox1.Text), i, 1) If num Mod (2) = 0 Then par = num + par Else impar = num + impar End If Next TextBox3.Text = par TextBox4.Text = impar TextBox5.Text = par + impar 'mayor For i = 1 To cuanto mayor = Mid(TextBox1.Text, i, 1) If mayor > mayors Then mayors = Mid(TextBox1.Text, i, 1) mayors = mayor End If Next TextBox6.Text = mayors 'menor For i = 1 To cuanto mayor = Mid(TextBox1.Text, i, 1) If mayor < mayors Then mayors = Mid(TextBox1.Text, i, 1) mayors = mayor End If Next TextBox7.Text = mayors 'divisores For i = 1 To Val(TextBox1.Text) Step 1 d = Val(TextBox1.Text) Mod i If d = 0 Then ListBox1.Items.Add(i) End If Next End 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 = cuanto While whi1 < cuanto whi1 += 1 num = Mid(Val(TextBox1.Text), whi1, 1) If num Mod (2) = 0 Then par = num + par Else impar = num + impar End If End While TextBox3.Text = par TextBox4.Text = impar TextBox5.Text = par + impar 'mayor While mayor < cuanto mayor += 1 mayors = Mid(TextBox1.Text, mayor, 1) If mayors > mayorss Then mayorss = Mid(TextBox1.Text, mayor, 1) mayorss = mayors End If End While TextBox6.Text = mayorss 'menor mayor = 0 While mayor < cuanto mayor += 1 mayors = Mid(TextBox1.Text, mayor, 1) If mayors < mayorss Then mayorss = Mid(TextBox1.Text, mayor, 1) mayorss = mayors End If End While TextBox7.Text = mayorss 'divisores While d1 <= Val(TextBox1.Text) d1 += 1 d = Val(TextBox1.Text) Mod d1 If 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 As System.EventArgs) Handles Button3.Click Dim cuanto, par, impar, num, whi1, mayor, mayors, mayorss, d, d1 As Integer cuanto = Len(TextBox1.Text) TextBox2.Text = cuanto Do whi1 += 1 num = Mid(Val(TextBox1.Text), whi1, 1) If num Mod (2) = 0 Then par = num + par Else impar = num + impar End If Loop Until whi1 >= cuanto TextBox3.Text = par TextBox4.Text = impar TextBox5.Text = par + impar 'mayor Do mayor += 1 mayors = Mid(TextBox1.Text, mayor, 1) If mayors > mayorss Then mayorss = Mid(TextBox1.Text, mayor, 1) mayorss = mayors End If Loop Until mayor >= cuanto TextBox6.Text = mayorss 'menor mayor = 0 Do mayor += 1 mayors = Mid(TextBox1.Text, mayor, 1) If mayors < mayorss Then mayorss = Mid(TextBox1.Text, mayor, 1) mayorss = mayors End If Loop Until mayor >= cuanto TextBox7.Text = mayorss 'divisores Do d1 += 1 d = Val(TextBox1.Text) Mod d1 If 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) Handles Button4.Click Dim cuanto, par, impar, num, whi1, mayor, mayors, mayorss, d, d1 As Integer cuanto = Len(TextBox1.Text) TextBox2.Text = cuanto Do While whi1 < cuanto whi1 += 1 num = Mid(Val(TextBox1.Text), whi1, 1) If num Mod (2) = 0 Then par = num + par Else impar = num + impar End If Loop TextBox3.Text = par TextBox4.Text = impar TextBox5.Text = par + impar 'mayor Do While mayor < cuanto mayor += 1 mayors = Mid(TextBox1.Text, mayor, 1) If mayors > mayorss Then mayorss = Mid(TextBox1.Text, mayor, 1) mayorss = mayors End If Loop TextBox6.Text = mayorss 'menor mayor = 0 Do While mayor < cuanto mayor += 1 mayors = Mid(TextBox1.Text, mayor, 1) If mayors < mayorss Then mayorss = Mid(TextBox1.Text, mayor, 1) mayorss = mayors End If Loop TextBox7.Text = mayorss 'divisores Do While d1 <= Val(TextBox1.Text) d1 += 1 d = Val(TextBox1.Text) Mod d1 If 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 'Limpiar TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" ListBox1.Items.Clear() TextBox1.Focus()

End Sub End Class

Leonel Navarrete


TABLAS DE MULTIPLICAR

Leonel Navarrete


Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12 As Integer Dim tab1, tab2, tab3, tab4, tab5, tab6, tab7, tab8, tab9, tab10, tab11, tab12 As Integer While n1 <= 10 ListBox1.Items.Add(n1.ToString & " * 1" & "= " & tab1) n1 += 1 tab1 = n1 * 1 ListBox2.Items.Add(n2.ToString & " * 2" & "= " & tab2) n2 += 1 tab2 = n1 * 2 ListBox3.Items.Add(n3.ToString & " * 3" & "= " & tab3) n3 += 1 tab3 = n3 * 3 ListBox4.Items.Add(n4.ToString & " * 4" & "= " & tab4) n4 += 1 tab4 = n4 * 4 ListBox5.Items.Add(n5.ToString & " * 5" & "= " & tab5) n5 += 1 tab5 = n5 * 5 ListBox6.Items.Add(n6.ToString & " * 6" & "= " & tab6) n6 += 1 tab6 = n6 * 6 ListBox7.Items.Add(n7.ToString & " * 7" & "= " & tab7) n7 += 1 tab7 = n7 * 7 ListBox8.Items.Add(n8.ToString & " * 8" & "= " & tab8) n8 += 1 tab8 = n8 * 8 ListBox9.Items.Add(n9.ToString & " * 9" & "= " & tab9) n9 += 1 tab9 = n9 * 9 ListBox10.Items.Add(n10.ToString & " * 10" & "= " & tab10) n10 += 1 tab10 = n10 * 10 ListBox11.Items.Add(n11.ToString & " * 11" & "= " & tab11) n11 += 1 tab11 = n11 * 11 ListBox12.Items.Add(n12.ToString & " * 12" & "= " & tab12) n12 += 1 tab12 = n12 * 12 End While End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class Leonel Navarrete


Vector n posiciones

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim n1, n2, n3 As Integer n1 = InputBox("Ingrese 1掳 Vector") Dim vec(n1) As Integer For 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) Next For i = 1 To n2 ListBox2.Items.Add(vec(i)) Next Else MsgBox("ingrese numero mayor que vector 1") End End If End Sub End Class Leonel Navarrete


While – Do – Do While

Public Class Form1 Dim x As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click x = 0 While x <= 10 TextBox1.Text &= x.ToString & " " x += 1 End While End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click x = 0 Do While x <= 10 TextBox3.Text &= x.ToString & " " x += 1 Loop End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click x = 0 Do TextBox2.Text &= x.ToString & " " x += 1 Loop Until x > 10 End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click End End 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 As System.EventArgs) Handles Button1.Click ListBox1.Items.Clear() ListBox2.Items.Clear() ListBox3.Items.Clear() Dim f1, f2, f3 As Integer 'ingrese magnitud vector f1 = InputBox("Ingrese el límite 1º vector") f2 = InputBox("Ingrese el límite 2º vector") f3 = f1 If f1 = f2 Then Dim v1(f1), v2(f2), vs(f1) 'ingrese vector 1 For i = 1 To f1 v1(i) = InputBox("INGRESE VECTOR DE POSICIÓN: " & i) ListBox1.Items.Add(v1(i)) Next 'ingreso vector 2 For i = 1 To f2 v2(i) = InputBox("INGRESE VECTOR DE POSICIÓN: " & i) ListBox2.Items.Add(v2(i)) Next 'suma vectores For i = 1 To f3 vs(i) = Val(v1(i)) + Val(v2(i)) ListBox3.Items.Add(vs(i)) Next Else MsgBox("Vectores desiguales") End If End Sub

Leonel Navarrete


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ListBox1.Items.Clear() ListBox2.Items.Clear() ListBox3.Items.Clear() Dim f1, f2, f3 As Integer 'ingrese magnitud vector f1 = InputBox("Ingrese el límite 1º vector") f2 = InputBox("Ingrese el límite 2º vector") f3 = f1 If f1 = f2 Then Dim v1(f1), v2(f2), vs(f1) 'ingrese vector 1 For i = 1 To f1 v1(i) = InputBox("INGRESE VECTOR DE POSICIÓN: " & i) ListBox1.Items.Add(v1(i)) Next 'ingreso vector 2 For i = 1 To f2 v2(i) = InputBox("INGRESE VECTOR DE POSICIÓN: " & i) ListBox2.Items.Add(v2(i)) Next 'resta vectores For i = 1 To f3 vs(i) = Val(v1(i)) - Val(v2(i)) ListBox3.Items.Add(vs(i)) Next

Else MsgBox("Vectores desiguales") End If End Sub End Class

Leonel Navarrete


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.