You are on page 1of 53

Universidad Nacional Jorge Basadre Grohmann-ITEL

Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

UNIVERSIDAD NACIONAL JORGE BASADRE GROHMANNTA C N A

INSTITUTO DE INFORMATICA Y TELECOMUNICACIONES

ITEL
TRABAJO FINAL CURSO DOCENTE ALUMNOS : Microsoft Visual Basic.Net I : Miguel Condori. : Pablo Ramirez Janeth Medina Hugo Flores

CICLO

: CUARTO

TURNO

Maana.

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Formulario de Bienvenida Nombre: FrmBienvenida Codificacin: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm As New frmclave() frm.Show() Me.Hide() End Sub

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub frmclave_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load txtusuario.Text = "" txtclave.Text = "" End Sub Private Sub btnaceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaceptar.Click Static nveces As Int16 If Me.txtclave.Text.ToUpper = "ITEL" Then MsgBox("Bienvenido Usuario " & txtusuario.Text.ToUpper, MsgBoxStyle.Exclamation, "UNJBG - ITEL") Dim form As New FrmPrincipal() form.Show() Me.Hide() Else MsgBox("Acceso denegado, Usuario: " & txtusuario.Text.ToUpper, MsgBoxStyle.Critical, Now) nveces = nveces + 1 txtusuario.Text = "" txtclave.Text = "" txtusuario.Focus() If nveces >= 3 Then MsgBox("Lo siento, tuvo 3 oportunidades... para otra vez ser ", MsgBoxStyle.Exclamation, Now) Me.Close() End If End If End Sub Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click End End Sub Private Sub txtusuario_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtusuario.KeyPress Select Case e.KeyChar Case Chr(13) txtclave.Focus() End Select End Sub Private Sub txtclave_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtclave.KeyPress Select Case e.KeyChar Case Chr(13) btnaceptar.Focus() End Select End Sub Private Sub txtusuario_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtusuario.TextChanged End Sub End Class

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub MnuVerBHerr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuVerBHerr.Click Static x As Integer If x = 1 Then ToolBar1.Visible = True MnuVerBHerr.Checked = True x = 0 Else ToolBar1.Visible = False MnuVerBHerr.Checked = False x = 1 End If End Sub Private Sub MnuVerBest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuVerBest.Click Static x As Integer If x = 1 Then StatusBar1.Visible = True MnuVerBest.Checked = True x = 0 Else StatusBar1.Visible = False MnuVerBest.Checked = False x = 1 End If End Sub Private Sub MnuVentana01_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuVentana01.Click Me.LayoutMdi(MdiLayout.Cascade) End Sub

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub MnuVentana02_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuVentana02.Click Me.LayoutMdi(MdiLayout.TileVertical) End Sub Private Sub MnuVentana03_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuVentana03.Click Me.LayoutMdi(MdiLayout.TileHorizontal) End Sub Private Sub MnuUtiCalculadora_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuUtiCalculadora.Click System.Diagnostics.Process.Start("calc.exe") End Sub Private Sub MnuUtiREloj_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuUtiREloj.Click Dim frm As New Frmreloj() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuUtiBNotas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuUtiBNotas.Click System.Diagnostics.Process.Start("notepad.exe") End Sub Private Sub MnuApli01_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli01.Click Dim frm As New FrmMeses() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli02_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli02.Click Dim frm As New FrmTipoCambio() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli03_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli03.Click Dim frm As New FrmMillasAkilometros() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli04_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli04.Click Dim frm As New FrmPupiletras() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli05_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli05.Click Dim frm As New FrmSupermercado() frm.MdiParent = Me

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

frm.Show() End Sub Private Sub MnuApli06_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli06.Click Dim frm As New FrmTragamonedas() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli07_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli07.Click Dim frm As New FrmKilometros() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli08_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli08.Click Dim frm As New FrmCalculadora() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli09_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli09.Click Dim frm As New FrmTraslado() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli10.Click Dim frm As New FrmMatriz() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli11.Click Dim frm As New FrmPension() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli12.Click Dim frm As New FrmSumatoria() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli13.Click Dim frm As New FrmFuncion() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli14.Click

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Dim frm As New FrmLetras() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli15.Click Dim frm As New FrmEscuela() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli16.Click Dim frm As New FrmRestaurante() frm.MdiParent = Me frm.Show() End Sub Private Sub MnuApli17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuApli17.Click Dim frm As New FrmSerie() frm.MdiParent = Me frm.Show() End Sub Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click Me.Close() End End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.StatusBar1.Panels(1).Text = DateString Me.StatusBar1.Panels(2).Text = TimeString End Sub Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick Select Case ToolBar1.Buttons.IndexOf(e.Button) Case 0 Dim frm As New FrmCalculadora() frm.Show() Case 1 Dim frm As New Frmreloj() frm.show() Case 2 System.Diagnostics.Process.Start("notepad.exe") Case 3 Me.Close() End End Select End Sub End Class

1.-

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub BtnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalcular.Click Dim edad, mes As Integer edad = Val(Me.TxtAos.Text) mes = edad * 12 TxtMeses.Text = Str(mes) BtnNuevo.Focus() End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.TxtAos.Text = "" Me.TxtMeses.Text = "" TxtAos.Focus() End Sub Private Sub TxtAos_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtAos.KeyPress Select Case e.KeyChar Case Chr(13) BtnCalcular.Focus() End Select End Sub End Class

2.-

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub TxtSoles_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtSoles.KeyPress Select Case e.KeyChar Case Chr(13) Dim sol, dol, pes As Single sol = Val(Me.TxtSoles.Text) dol = InputBox("Ingrese cambio por dolar") pes = InputBox("Ingrese cambio por peso") dol = sol / dol pes = sol * pes TxtDolares.Text = Str(dol) TxtPesos.Text = Str(pes) BtnNuevo.Focus() End Select End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.TxtSoles.Text = "" Me.TxtDolares.Text = "" Me.TxtPesos.Text = "" TxtSoles.Focus() End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub Private Sub TxtSoles_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtSoles.TextChanged End Sub End Class

3.-

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub Btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnnuevo.Click Me.txtingresar.Text = "" Me.txtresultado.Text = "" Me.txtingresar.Focus() End Sub Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click Me.Close() End Sub Private Sub btnconvertir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnconvertir.Click Dim a, b As Integer Dim x, z As Single a = Val(Me.txtingresar.Text) x = (1.609) z = (a * x) Me.txtresultado.Text = Str(z) End Sub End Class

4.-

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click Me.Label1.ForeColor = ForeColor.Blue Me.Label8.ForeColor = ForeColor.Blue Me.Label13.ForeColor = ForeColor.Blue Me.Label19.ForeColor = ForeColor.Blue Me.Label25.ForeColor = ForeColor.Blue End Sub Private Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label9.Click Me.Label6.ForeColor = ForeColor.Red Me.Label7.ForeColor = ForeColor.Red Me.Label8.ForeColor = ForeColor.Red Me.Label9.ForeColor = ForeColor.Red Me.Label10.ForeColor = ForeColor.Red End Sub Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click Me.Label2.ForeColor = ForeColor.Green Me.Label3.ForeColor = ForeColor.Green Me.Label4.ForeColor = ForeColor.Green End Sub Private Sub Label21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label21.Click Me.Label21.ForeColor = ForeColor.Violet Me.Label22.ForeColor = ForeColor.Violet Me.Label23.ForeColor = ForeColor.Violet Me.Label24.ForeColor = ForeColor.Violet Me.Label25.ForeColor = ForeColor.Violet End Sub Private Sub Label15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label15.Click Me.Label10.ForeColor = ForeColor.Chocolate Me.Label15.ForeColor = ForeColor.Chocolate Me.Label20.ForeColor = ForeColor.Chocolate End Sub Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.Click Me.Label1.ForeColor = ForeColor.Blue Me.Label8.ForeColor = ForeColor.Blue Me.Label13.ForeColor = ForeColor.Blue Me.Label19.ForeColor = ForeColor.Blue Me.Label25.ForeColor = ForeColor.Blue End Sub Private Sub Label13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label13.Click Me.Label1.ForeColor = ForeColor.Blue Me.Label8.ForeColor = ForeColor.Blue Me.Label13.ForeColor = ForeColor.Blue Me.Label19.ForeColor = ForeColor.Blue Me.Label25.ForeColor = ForeColor.Blue End Sub

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub Label19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label19.Click Me.Label1.ForeColor = ForeColor.Blue Me.Label8.ForeColor = ForeColor.Blue Me.Label13.ForeColor = ForeColor.Blue Me.Label19.ForeColor = ForeColor.Blue Me.Label25.ForeColor = ForeColor.Blue End Sub Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click Me.Label2.ForeColor = ForeColor.Green Me.Label3.ForeColor = ForeColor.Green Me.Label4.ForeColor = ForeColor.Green End Sub Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click Me.Label2.ForeColor = ForeColor.Green Me.Label3.ForeColor = ForeColor.Green Me.Label4.ForeColor = ForeColor.Green End Sub Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click Me.Label6.ForeColor = ForeColor.Red Me.Label7.ForeColor = ForeColor.Red Me.Label8.ForeColor = ForeColor.Red Me.Label9.ForeColor = ForeColor.Red Me.Label10.ForeColor = ForeColor.Red End Sub Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click Me.Label6.ForeColor = ForeColor.Red Me.Label7.ForeColor = ForeColor.Red Me.Label8.ForeColor = ForeColor.Red Me.Label9.ForeColor = ForeColor.Red Me.Label10.ForeColor = ForeColor.Red End Sub Private Sub Label10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label10.Click Me.Label6.ForeColor = ForeColor.Red Me.Label7.ForeColor = ForeColor.Red Me.Label8.ForeColor = ForeColor.Red Me.Label9.ForeColor = ForeColor.Red Me.Label10.ForeColor = ForeColor.Red End Sub Private Sub Label20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label20.Click Me.Label10.ForeColor = ForeColor.Chocolate Me.Label15.ForeColor = ForeColor.Chocolate Me.Label20.ForeColor = ForeColor.Chocolate End Sub Private Sub Label22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label22.Click Me.Label21.ForeColor = ForeColor.Violet Me.Label22.ForeColor = ForeColor.Violet

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Me.Label23.ForeColor = ForeColor.Violet Me.Label24.ForeColor = ForeColor.Violet Me.Label25.ForeColor = ForeColor.Violet End Sub Private Sub Label23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label23.Click Me.Label21.ForeColor = ForeColor.Violet Me.Label22.ForeColor = ForeColor.Violet Me.Label23.ForeColor = ForeColor.Violet Me.Label24.ForeColor = ForeColor.Violet Me.Label25.ForeColor = ForeColor.Violet End Sub Private Sub Label24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label24.Click Me.Label21.ForeColor = ForeColor.Violet Me.Label22.ForeColor = ForeColor.Violet Me.Label23.ForeColor = ForeColor.Violet Me.Label24.ForeColor = ForeColor.Violet Me.Label25.ForeColor = ForeColor.Violet End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.Label1.ForeColor = ForeColor.Black Me.Label2.ForeColor = ForeColor.Black Me.Label3.ForeColor = ForeColor.Black Me.Label4.ForeColor = ForeColor.Black Me.Label5.ForeColor = ForeColor.Black Me.Label6.ForeColor = ForeColor.Black Me.Label7.ForeColor = ForeColor.Black Me.Label8.ForeColor = ForeColor.Black Me.Label9.ForeColor = ForeColor.Black Me.Label10.ForeColor = ForeColor.Black Me.Label11.ForeColor = ForeColor.Black Me.Label12.ForeColor = ForeColor.Black Me.Label13.ForeColor = ForeColor.Black Me.Label14.ForeColor = ForeColor.Black End Sub End Class

5.-

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub BtnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalcular.Click Dim x, y, z, fre, d, cafe, torti, netom, netoa As Single Static dcto, r, tot As Single 'r = r + 1 If r < 12 Then r = r + 1 If Me.ChkFrejol.Checked = True Then fre = 8.75 d = fre * 0.03 End If If Me.ChkTortilla.Checked = True Then torti = 3.55 d = torti * 0.03 End If If Me.ChkCafe.Checked = True Then cafe = 14.25 d = cafe * 0.03 End If tot = fre + torti + cafe + tot dcto = dcto + d MsgBox("este es el mes" & r) Me.ChkFrejol.Checked = False Me.ChkTortilla.Checked = False Me.ChkCafe.Checked = False Else x = Round(tot, 2) y = Round(dcto, 2) MsgBox("Compra finalizada") TxtBrutoAo.Text = Str(x) TxtDctoAo.Text = Str(y) netoa = tot - dcto z = Round(netoa, 2) TxtNetoAo.Text = Str(z) End If

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.ChkCafe.Checked = False Me.ChkFrejol.Checked = False Me.ChkTortilla.Checked = False Me.TxtBrutoAo.Text = "" Me.TxtDctoAo.Text = "" Me.TxtNetoAo.Text = "" End Sub

6.-

Dim imagen(100) As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a, b, c As Integer Randomize() PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage PictureBox3.SizeMode = PictureBoxSizeMode.StretchImage imagen(1) = "c:\visual net\trabajo final\trabajo final\imagenes\CTRUSA.ICO" imagen(2) = "c:\visual net\trabajo final\trabajo final\imagenes\EARTH.ICO" imagen(3) = "c:\visual net\trabajo final\trabajo final\imagenes\FIRE.ICO"

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

imagen(4) = "c:\visual net\trabajo final\trabajo final\imagenes\HANDSHAK.ICO" imagen(5) = "c:\visual net\trabajo final\trabajo final\imagenes\LITENING.ICO" imagen(6) = "c:\visual net\trabajo final\trabajo final\imagenes\BICYCLE.ICO" imagen(7) = "c:\visual net\trabajo final\trabajo final\imagenes\CARS.ICO" imagen(8) = "c:\visual net\trabajo final\trabajo final\imagenes\PLANE.ICO" imagen(9) = "c:\visual net\trabajo final\trabajo final\imagenes\ROCKET.ICO" a = CInt(Int((9 * Rnd()) + 1)) b = CInt(Int((9 * Rnd()) + 1)) c = CInt(Int((9 * Rnd()) + 1)) PictureBox1.Image = Image.FromFile(imagen(a)) PictureBox2.Image = Image.FromFile(imagen(b)) PictureBox3.Image = Image.FromFile(imagen(c)) If a = b And a = c Then MsgBox("Gano Premio Mayor", 0, "Tragamonedas") End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub End Class

7.-

Private Sub BtnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalcular.Click Dim hora, kil, milla, w, x, y, z As Single Dim a, b As Integer x = Val(Me.TxtDistancia.Text) y = x / 1.609 z = Round(y, 2) 'TextBox2.Text = Str(z) hora = y / 30 w = Round(hora, 2) Me.TxtTiempo.Text = Str(w) & " horas"

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.TxtDistancia.Text = "" Me.TxtTiempo.Text = "" TxtDistancia.Focus() End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub Private Sub Txtdistancia_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtDistancia.KeyPress Select Case e.KeyChar Case Chr(13) BtnCalcular.Focus() End Select End Sub End Class

8.-

Public Class Inherits Dim n As Dim w As Double Dim l As

FrmCalculadora System.Windows.Forms.Form String, r As Double, p As Integer, k As Double Integer, s As Integer, h As Integer, f As Integer, k2 As Integer, s2 As Integer, m As Double

#Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent()

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents BtnPunto As System.Windows.Forms.Button Friend WithEvents BtnIgual As System.Windows.Forms.Button Friend WithEvents TxtPantalla As System.Windows.Forms.TextBox Friend WithEvents BtnUno As System.Windows.Forms.Button Friend WithEvents BtnDos As System.Windows.Forms.Button Friend WithEvents BtnTres As System.Windows.Forms.Button Friend WithEvents BtnCuatro As System.Windows.Forms.Button Friend WithEvents BtnCinco As System.Windows.Forms.Button Friend WithEvents BtnSeis As System.Windows.Forms.Button Friend WithEvents BtnSiete As System.Windows.Forms.Button Friend WithEvents BtnOcho As System.Windows.Forms.Button Friend WithEvents BtnNueve As System.Windows.Forms.Button Friend WithEvents BtnPor As System.Windows.Forms.Button Friend WithEvents BtnMas As System.Windows.Forms.Button Friend WithEvents BtnDivi As System.Windows.Forms.Button Friend WithEvents BtnMenos As System.Windows.Forms.Button Friend WithEvents BtnRaiz As System.Windows.Forms.Button Friend WithEvents BtnPi As System.Windows.Forms.Button Friend WithEvents BtnBorrar As System.Windows.Forms.Button Friend WithEvents BtnCero As System.Windows.Forms.Button Friend WithEvents BtnSalir As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FrmCalculadora)) Me.BtnCero = New System.Windows.Forms.Button() Me.BtnPunto = New System.Windows.Forms.Button() Me.BtnIgual = New System.Windows.Forms.Button() Me.TxtPantalla = New System.Windows.Forms.TextBox() Me.BtnUno = New System.Windows.Forms.Button() Me.BtnDos = New System.Windows.Forms.Button() Me.BtnTres = New System.Windows.Forms.Button() Me.BtnCuatro = New System.Windows.Forms.Button() Me.BtnCinco = New System.Windows.Forms.Button() Me.BtnSeis = New System.Windows.Forms.Button() Me.BtnSiete = New System.Windows.Forms.Button() Me.BtnOcho = New System.Windows.Forms.Button() Me.BtnNueve = New System.Windows.Forms.Button() Me.BtnPor = New System.Windows.Forms.Button()

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Me.BtnMas = New System.Windows.Forms.Button() Me.BtnDivi = New System.Windows.Forms.Button() Me.BtnMenos = New System.Windows.Forms.Button() Me.BtnRaiz = New System.Windows.Forms.Button() Me.BtnPi = New System.Windows.Forms.Button() Me.BtnBorrar = New System.Windows.Forms.Button() Me.BtnSalir = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'BtnCero ' Me.BtnCero.Location = New System.Drawing.Point(48, 168) Me.BtnCero.Name = "BtnCero" Me.BtnCero.Size = New System.Drawing.Size(32, 32) Me.BtnCero.TabIndex = 10 Me.BtnCero.Text = "0" ' 'BtnPunto ' Me.BtnPunto.Location = New System.Drawing.Point(80, 168) Me.BtnPunto.Name = "BtnPunto" Me.BtnPunto.Size = New System.Drawing.Size(32, 32) Me.BtnPunto.TabIndex = 11 Me.BtnPunto.Text = "." ' 'BtnIgual ' Me.BtnIgual.Location = New System.Drawing.Point(112, 168) Me.BtnIgual.Name = "BtnIgual" Me.BtnIgual.Size = New System.Drawing.Size(32, 32) Me.BtnIgual.TabIndex = 12 Me.BtnIgual.Text = "=" ' 'TxtPantalla ' Me.TxtPantalla.Location = New System.Drawing.Point(48, 40) Me.TxtPantalla.Name = "TxtPantalla" Me.TxtPantalla.Size = New System.Drawing.Size(168, 20) Me.TxtPantalla.TabIndex = 14 Me.TxtPantalla.Text = "" ' 'BtnUno ' Me.BtnUno.Location = New System.Drawing.Point(48, 136) Me.BtnUno.Name = "BtnUno" Me.BtnUno.Size = New System.Drawing.Size(32, 32) Me.BtnUno.TabIndex = 15 Me.BtnUno.Text = "1" ' 'BtnDos ' Me.BtnDos.Location = New System.Drawing.Point(80, 136) Me.BtnDos.Name = "BtnDos" Me.BtnDos.Size = New System.Drawing.Size(32, 32) Me.BtnDos.TabIndex = 16 Me.BtnDos.Text = "2" ' 'BtnTres ' Me.BtnTres.Location = New System.Drawing.Point(112, 136) Me.BtnTres.Name = "BtnTres"

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Me.BtnTres.Size = New System.Drawing.Size(32, 32) Me.BtnTres.TabIndex = 17 Me.BtnTres.Text = "3" ' 'BtnCuatro ' Me.BtnCuatro.Location = New System.Drawing.Point(48, 104) Me.BtnCuatro.Name = "BtnCuatro" Me.BtnCuatro.Size = New System.Drawing.Size(32, 32) Me.BtnCuatro.TabIndex = 18 Me.BtnCuatro.Text = "4" ' 'BtnCinco ' Me.BtnCinco.Location = New System.Drawing.Point(80, 104) Me.BtnCinco.Name = "BtnCinco" Me.BtnCinco.Size = New System.Drawing.Size(32, 32) Me.BtnCinco.TabIndex = 19 Me.BtnCinco.Text = "5" ' 'BtnSeis ' Me.BtnSeis.Location = New System.Drawing.Point(112, 104) Me.BtnSeis.Name = "BtnSeis" Me.BtnSeis.Size = New System.Drawing.Size(32, 32) Me.BtnSeis.TabIndex = 20 Me.BtnSeis.Text = "6" ' 'BtnSiete ' Me.BtnSiete.Location = New System.Drawing.Point(48, 72) Me.BtnSiete.Name = "BtnSiete" Me.BtnSiete.Size = New System.Drawing.Size(32, 32) Me.BtnSiete.TabIndex = 21 Me.BtnSiete.Text = "7" ' 'BtnOcho ' Me.BtnOcho.Location = New System.Drawing.Point(80, 72) Me.BtnOcho.Name = "BtnOcho" Me.BtnOcho.Size = New System.Drawing.Size(32, 32) Me.BtnOcho.TabIndex = 22 Me.BtnOcho.Text = "8" ' 'BtnNueve ' Me.BtnNueve.Location = New System.Drawing.Point(112, 72) Me.BtnNueve.Name = "BtnNueve" Me.BtnNueve.Size = New System.Drawing.Size(32, 32) Me.BtnNueve.TabIndex = 23 Me.BtnNueve.Text = "9" ' 'BtnPor ' Me.BtnPor.Location = New System.Drawing.Point(144, 104) Me.BtnPor.Name = "BtnPor" Me.BtnPor.Size = New System.Drawing.Size(40, 32) Me.BtnPor.TabIndex = 24 Me.BtnPor.Text = "X" ' 'BtnMas

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

' Me.BtnMas.Location = New System.Drawing.Point(144, 72) Me.BtnMas.Name = "BtnMas" Me.BtnMas.Size = New System.Drawing.Size(40, 32) Me.BtnMas.TabIndex = 25 Me.BtnMas.Text = "+" ' 'BtnDivi ' Me.BtnDivi.Location = New System.Drawing.Point(184, 104) Me.BtnDivi.Name = "BtnDivi" Me.BtnDivi.Size = New System.Drawing.Size(40, 32) Me.BtnDivi.TabIndex = 27 Me.BtnDivi.Text = "/" ' 'BtnMenos ' Me.BtnMenos.Location = New System.Drawing.Point(184, 72) Me.BtnMenos.Name = "BtnMenos" Me.BtnMenos.Size = New System.Drawing.Size(40, 32) Me.BtnMenos.TabIndex = 28 Me.BtnMenos.Text = "-" ' 'BtnRaiz ' Me.BtnRaiz.Location = New System.Drawing.Point(144, 136) Me.BtnRaiz.Name = "BtnRaiz" Me.BtnRaiz.Size = New System.Drawing.Size(40, 32) Me.BtnRaiz.TabIndex = 31 Me.BtnRaiz.Text = "Raiz" ' 'BtnPi ' Me.BtnPi.Location = New System.Drawing.Point(184, 136) Me.BtnPi.Name = "BtnPi" Me.BtnPi.Size = New System.Drawing.Size(40, 32) Me.BtnPi.TabIndex = 32 Me.BtnPi.Text = "Pi" ' 'BtnBorrar ' Me.BtnBorrar.Location = New System.Drawing.Point(144, 168) Me.BtnBorrar.Name = "BtnBorrar" Me.BtnBorrar.Size = New System.Drawing.Size(80, 32) Me.BtnBorrar.TabIndex = 33 Me.BtnBorrar.Text = "C" ' 'BtnSalir ' Me.BtnSalir.Location = New System.Drawing.Point(104, 216) Me.BtnSalir.Name = "BtnSalir" Me.BtnSalir.TabIndex = 34 Me.BtnSalir.Text = "&Salir" ' 'FrmCalculadora ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Bitmap) Me.ClientSize = New System.Drawing.Size(264, 262)

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.BtnSalir, Me.BtnBorrar, Me.BtnPi, Me.BtnRaiz, Me.BtnMenos, Me.BtnDivi, Me.BtnMas, Me.BtnPor, Me.BtnNueve, Me.BtnOcho, Me.BtnSiete, Me.BtnSeis, Me.BtnCinco, Me.BtnCuatro, Me.BtnTres, Me.BtnDos, Me.BtnUno, Me.TxtPantalla, Me.BtnIgual, Me.BtnPunto, Me.BtnCero}) Me.Name = "FrmCalculadora" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Calculadora" Me.ResumeLayout(False) End Sub #End Region Private Sub escribir() 'esta funcin permite ingresar lod nmeros dgito por dgito If l < 28 Then If Me.TxtPantalla.Text = "0" Or w = 1 Then Me.TxtPantalla.Text = n w = 0 Else Me.TxtPantalla.Text = Me.TxtPantalla.Text + n End If End If End Sub Private Sub escribirp() ' esta funcin permite ingresar solamente un punto decimal If l < 27 Then If p = 0 Then If w = 1 Then Me.TxtPantalla.Text = "0." w = 0 p = 1 Else Me.TxtPantalla.Text = Me.TxtPantalla.Text + "." p = 1 End If End If End If End Sub Private Sub BtnBorrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBorrar.Click p = 0 w = 1 l = 0 Me.TxtPantalla.Text = 0 End Sub Private Sub respuesta() ' funcin k = Val(Me.TxtPantalla.Text) Select Case Val(s) Case 1 Me.TxtPantalla.Text = Case 2 Me.TxtPantalla.Text = Case 3 Me.TxtPantalla.Text = del igual

r + k r - k r * k

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Case 4 If k <> 0 Then Me.TxtPantalla.Text = r / k Else Me.TxtPantalla.Text = "error" desactivados() End If Case 6 Me.TxtPantalla.Text = r ^ k End Select End Sub Sub desactivados() ' desactiva los botones al generar error If Me.TxtPantalla.Text = "error" Then Me.BtnUno.Enabled = False Me.BtnDos.Enabled = False Me.BtnTres.Enabled = False Me.BtnCuatro.Enabled = False Me.BtnCinco.Enabled = False Me.BtnSeis.Enabled = False Me.BtnSiete.Enabled = False Me.BtnOcho.Enabled = False Me.BtnNueve.Enabled = False Me.BtnCero.Enabled = False Me.BtnIgual.Enabled = False Me.BtnMas.Enabled = False Me.BtnMenos.Enabled = False Me.BtnPor.Enabled = False Me.BtnDivi.Enabled = False Me.BtnPunto.Enabled = False Me.BtnRaiz.Enabled = False Me.BtnPi.Enabled = False Else ' al llamar nuevamente a este mtodo se aactivan los botones Me.BtnUno.Enabled = True Me.BtnDos.Enabled = True Me.BtnTres.Enabled = True Me.BtnCuatro.Enabled = True Me.BtnCinco.Enabled = True Me.BtnSeis.Enabled = True Me.BtnSiete.Enabled = True Me.BtnOcho.Enabled = True Me.BtnNueve.Enabled = True Me.BtnCero.Enabled = True Me.BtnIgual.Enabled = True Me.BtnMas.Enabled = True Me.BtnMenos.Enabled = True Me.BtnPor.Enabled = True Me.BtnDivi.Enabled = True Me.BtnPunto.Enabled = True Me.BtnRaiz.Enabled = True Me.BtnPi.Enabled = True End If End Sub Sub respuestaop() 'permite una serie de operaciones prescindiendo del igual If s2 = s Then Select Case Val(s) Case 1 r = r + k2

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Me.TxtPantalla.Text = r Case 2 r = r - k2 Me.TxtPantalla.Text = r Case 3 r = r * k2 Me.TxtPantalla.Text = r Case 4 If k2 <> 0 Then r = r / k2 Me.TxtPantalla.Text = r Else Me.TxtPantalla.Text = "error" r = 0 desactivados() End If Case 6 r = r ^ k2 Me.TxtPantalla.Text = r End Select Else Select Case Val(s2) Case 1 r = r + k2 Me.TxtPantalla.Text = r Case 2 r = r - k2 Me.TxtPantalla.Text = r Case 3 r = r * k2 Me.TxtPantalla.Text = r Case 4 If k2 <> 0 Then r = r / k2 Me.TxtPantalla.Text = r Else Me.TxtPantalla.Text = "error" r = 0 desactivados() End If Case 6 r = r ^ k2 Me.TxtPantalla.Text = r End Select End If End Sub Private Sub operadores() ' pone la condicin para prescindir del igual k = Val(Me.TxtPantalla.Text) w = 1 p = 0 If f = 0 Then 'si f se hace 1 el operador funciona adems como signo igual r = k f = 1 Else k2 = k respuestaop() End If End Sub

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub BtnMas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMas.Click s2 = s s = 1 l = 0 operadores() End Sub Private Sub BtnDos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDos.Click l = l + 1 n = 2 escribir() End Sub Private Sub BtnDivi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDivi.Click s2 = s s = 4 l = 0 operadores() End Sub Sub reiniciar() ' regresa a las variables a sus valores iniciales k = 0 'captura el nmero ingresado r = 0 'almacena el primer miembro en una operacin p = 0 ' controla el ingreso del punto flotante o coma decimal w = 1 ' permite el ingreso del primer dgito s = 0 ' almacena el operador s2 = 5 l = 0 'controla la longitud mxima del nmero en la calculadora End Sub Private Sub BtnIgual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnIgual.Click f = 0 respuesta() reiniciar() End Sub Private Sub BtnMenos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMenos.Click s2 = s l = 0 s = 2 operadores() End Sub Private Sub BtnOcho_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOcho.Click l = l + 1 n = 8 escribir() End Sub Private Sub BtnPi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPi.Click TxtPantalla.Text = 3.14159265358979 End Sub Private Sub BtnPor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPor.Click

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

s2 = s s = 3 l = 0 operadores() End Sub Private Sub BtnRaiz_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRaiz.Click l = 0 w = 1 p = 0 If Val(Me.TxtPantalla.Text) >= 0 Then TxtPantalla.Text = Sqrt(Val(TxtPantalla.Text)) Else TxtPantalla.Text = "error" desactivados() End If End Sub Private Sub BtnTres_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTres.Click l = l + 1 n = 3 escribir() End Sub Private Sub BtnCuatro_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCuatro.Click l = l + 1 n = 4 escribir() End Sub Private Sub BtnCinco_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCinco.Click l = l + 1 n = 5 escribir() End Sub Private Sub BtnSeis_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSeis.Click l = l + 1 n = 6 escribir() End Sub Private Sub BtnSiete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSiete.Click l = l + 1 n = 7 escribir() End Sub Private Sub BtnNueve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNueve.Click l = l + 1 n = 9 escribir() End Sub

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub BtnCero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCero.Click l = l + 1 n = 0 escribir() End Sub Private Sub FrmCalculadora_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load p = 0 w = 0 f = 0 s = 0 l = 0 s2 = 5 End Sub Private Sub BtnPunto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPunto.Click l = l + 1 escribirp() End Sub Private Sub BtnUno_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnUno.Click l = l + 1 n = 1 escribir() End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub End Class

9.-

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click If RbtnTodo.Checked = True Then Me.ListBox2.Items.AddRange(ListBox1.Items) Me.ListBox1.Items.Clear() End If If RbtnUno.Checked = True Then If ListBox1.SelectedItems.Count = 0 Then MsgBox("Debe seleccionar un Item") ListBox1.Focus() Else Me.ListBox2.Items.Add(ListBox1.SelectedItem) Me.ListBox1.Items.Remove(ListBox1.SelectedItem) End If End If If RbtnVarios.Checked = True Then If ListBox1.SelectedItems.Count > 1 Then Me.ListBox2.Items.Add(ListBox1.SelectedValue) Me.ListBox1.Items.Remove(ListBox1.SelectedItem) Else MsgBox("Debe Seleccionar varios Items") ListBox1.Focus() End If End If End Sub Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click If RbtnTodo.Checked = True Then Me.ListBox1.Items.AddRange(ListBox2.Items) Me.ListBox2.Items.Clear() End If If RbtnUno.Checked = True Then If ListBox2.SelectedItems.Count = 0 Then MsgBox("Debe seleccionar un Item") ListBox2.Focus() Else Me.ListBox1.Items.Add(ListBox2.SelectedItem) Me.ListBox2.Items.Remove(ListBox2.SelectedItem) End If End If If RbtnVarios.Checked = True Then If ListBox2.SelectedItems.Count > 1 Then Me.ListBox1.Items.Add(ListBox2.SelectedItems) Me.ListBox2.Items.Remove(ListBox2.ItemHeight) Else MsgBox("Debe Seleccionar varios Items") ListBox2.Focus() End If End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close() End Sub End Class

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

10.-

Dim num(20, 20) As String Dim rpta As String Dim puntero As Int16 Dim contador As Integer Dim total As Integer Private Sub Borrar() Me.txtnombres.Text = "" Me.txtApellidos.Text = "" Me.txtDireccion.Text = "" Me.txtEmail.Text = "" Me.txthobbies.Text = "" Me.ComboBox1.Text = "" Me.txtnombres.Focus() End Sub Private Sub btnagregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnagregar.Click Static cont As Integer Dim i As Integer Dim rpta As String If contador > 20 Then MsgBox("ya no puede registrarse mas cursos.....") Exit Sub End If rpta = MsgBox("Esta seguro que desea guardar ", MsgBoxStyle.YesNo) If rpta = vbYes Then cont = ComboBox1.Items.Count num(cont, 0) = Me.txtnombres.Text num(cont, 1) = Me.txtApellidos.Text num(cont, 2) = Me.txtDireccion.Text

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

num(cont, 3) = Me.txtEmail.Text num(cont, 4) = Me.txthobbies.Text total = cont cont += 1 Call botonA(True) Call botonB(True) Me.lstnombre.Items.Add(Me.txtnombres.Text) 'cambiado por (me.txtnombres.text) Me.lstapellidos.Items.Add(Me.txtApellidos.Text) Me.lstdireccion.Items.Add(Me.txtDireccion.Text) Me.lstemail.Items.Add(Me.txtEmail.Text) Me.lsthobies.Items.Add(Me.txthobbies.Text) Me.ComboBox1.Items.Add(Me.txtnombres.Text) Else Exit Sub Call Borrar() End If Me.btnnuevo.Enabled = True Me.btnagregar.Enabled = False End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim n, i, c, j As Integer Dim mensaje, estilo As String n = ComboBox1.Items.Count c = ComboBox1.SelectedIndex mensaje = "Deseas que muestre los datos" estilo = MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation + MsgBoxStyle.DefaultButton1 rpta = MsgBox(mensaje, estilo) If rpta = vbYes Then Me.lstnombre.Items.Clear() Me.lstapellidos.Items.Clear() Me.lstdireccion.Items.Clear() Me.lstemail.Items.Clear() Me.lsthobies.Items.Clear() For i = 0 To n If c = i Then Me.lstnombre.Items.Add(num(c, 0)) Me.lstapellidos.Items.Add(num(c, 1)) Me.lstdireccion.Items.Add(num(c, 2)) Me.lstemail.Items.Add(num(c, 3)) Me.lsthobies.Items.Add(num(c, 4)) End If Next Else Me.lstnombre.Items.Clear() Me.lstapellidos.Items.Clear() Me.lstdireccion.Items.Clear() Me.lstemail.Items.Clear() Me.lsthobies.Items.Clear() End If End Sub

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click Me.txtnombres.Text = "" Me.txtApellidos.Text = "" Me.txtDireccion.Text = "" Me.txtEmail.Text = "" Me.txthobbies.Text = "" Me.ComboBox1.Text = "" Me.txtnombres.Focus() Call botonA(False) Call botonB(False) Me.btnnuevo.Enabled = False Me.btnagregar.Enabled = True End Sub Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click Me.Close() End Sub Private Sub FrmMatriz_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call botonA(False) Call botonB(False) Me.btnnuevo.Enabled = True Me.btnagregar.Enabled = False End Sub Private Sub botonA(ByVal varx As Boolean) Me.btnPrimero.Enabled = varx Me.btnAnterior.Enabled = varx End Sub Private Sub botonB(ByVal varx As Boolean) Me.btnsiguente.Enabled = varx Me.btnultimo.Enabled = varx End Sub Private Sub btnPrimero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrimero.Click puntero = 0 Call mostrardatos() Call botonA(False) Call botonB(True) End Sub Private Sub btnAnterior_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnterior.Click If puntero > 0 Then puntero -= 1 Call mostrardatos() Call botonB(True) Else Call botonB(False) End If End Sub Private Sub btnsiguente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsiguente.Click If puntero < total Then puntero += 1

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Call mostrardatos() Call botonA(True) Else Call botonB(False) End If End Sub Private Sub btnultimo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnultimo.Click puntero = total Call mostrardatos() Call botonB(False) Call botonA(True) End Sub Private Sub mostrardatos() Me.txtnombres.Text = num(puntero, 0) Me.txtApellidos.Text = num(puntero, 1) Me.txtDireccion.Text = num(puntero, 2) Me.txtEmail.Text = num(puntero, 3) Me.txthobbies.Text = num(puntero, 4) End Sub Private Sub txtnombres_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnombres.KeyPress Select Case e.KeyChar Case Chr(13) txtApellidos.Focus() End Select End Sub Private Sub txtApellidos_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtApellidos.KeyPress Select Case e.KeyChar Case Chr(13) txtDireccion.Focus() End Select End Sub Private Sub txtEmail_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEmail.KeyPress Select Case e.KeyChar Case Chr(13) Me.txthobbies.Focus() End Select End Sub Private Sub txtDireccion_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDireccion.KeyPress Select Case e.KeyChar Case Chr(13) txtEmail.Focus() End Select End Sub Private Sub txthobbies_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txthobbies.KeyPress

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Select Case e.KeyChar Case Chr(13) btnagregar.Focus() End Select End Sub End Class

11.-

Private Sub TxtNombres_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtNombres.KeyPress Select Case e.KeyChar Case Chr(13) TxtEdad.Focus() End Select End Sub Private Sub TxtEdad_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtEdad.KeyPress Dim edad As Integer edad = Val(Me.TxtEdad.Text) Select Case e.KeyChar Case Chr(13) If edad < 18 Or edad > 26 Then MsgBox("Edad no contemplada") Me.TxtEdad.Text = "" TxtEdad.Focus() Else TxtNota.Focus() End If End Select End Sub Private Sub BtnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalcular.Click

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Dim edad, nota, pension, dcto, neto As Integer Dim condi As String edad = Val(Me.TxtEdad.Text) Select Case edad Case 18 To 20 condi = "pobre" pension = 400 Case 21 To 23 condi = "Media" pension = 600 Case 24 To 26 condi = "Alta" pension = 1000 End Select nota = Val(Me.TxtNota.Text) Select Case nota Case 15 To 18 dcto = pension * 0.08 Case 13 To 14 dcto = pension * 0.05 Case 11 To 12 dcto = pension * 0.01 Case 10 To 0 dcto = 0 MsgBox("no hay descuento") End Select neto = pension - dcto TxtCondi.Text = condi TxtPension.Text = Str(pension) TxtDcto.Text = Str(dcto) TxtNeto.Text = Str(neto) BtnNuevo.Focus() End Sub Private Sub TxtNota_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtNota.KeyPress Dim nota As Integer nota = Val(Me.TxtNota.Text) Select Case e.KeyChar Case Chr(13) If nota > 18 Or nota < 11 Then MsgBox("Nota fuera de rango") Me.TxtNota.Text = "" TxtNota.Focus() Else BtnCalcular.Focus() End If End Select End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.TxtNombres.Text = "" Me.TxtEdad.Text = "" Me.TxtNota.Text = "" Me.TxtCondi.Text = ""

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Me.TxtPension.Text = "" Me.TxtDcto.Text = "" Me.TxtNeto.Text = "" TxtNombres.Focus() End Sub End Class

12.-

Public Sub New() MyBase.New() 'El Diseador de Windows Forms requiere esta llamada. InitializeComponent() 'Agregar cualquier inicializacin despus de la llamada a InitializeComponent() End Sub 'Form reemplaza a Dispose para limpiar la lista de componentes. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Requerido por el Diseador de Windows Forms Private components As System.ComponentModel.IContainer 'NOTA: el Diseador de Windows Forms requiere el siguiente procedimiento 'Puede modificarse utilizando el Diseador de Windows Forms. 'No lo modifique con el editor de cdigo. Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents btnCalcular As System.Windows.Forms.Button Friend WithEvents BtnNuevo As System.Windows.Forms.Button Friend WithEvents btnSalir As System.Windows.Forms.Button Friend WithEvents txtnumero As System.Windows.Forms.TextBox Friend WithEvents Txtsuma As System.Windows.Forms.TextBox <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FrmSumatoria)) Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() Me.Label5 = New System.Windows.Forms.Label() Me.Label6 = New System.Windows.Forms.Label() Me.txtnumero = New System.Windows.Forms.TextBox() Me.Txtsuma = New System.Windows.Forms.TextBox() Me.btnCalcular = New System.Windows.Forms.Button() Me.BtnNuevo = New System.Windows.Forms.Button() Me.btnSalir = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'Label1 ' Me.Label1.BackColor = System.Drawing.Color.Transparent Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(16, 24) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(104, 32) Me.Label1.TabIndex = 0 Me.Label1.Text = "Sumatoria :" Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'Label2 ' Me.Label2.BackColor = System.Drawing.Color.Transparent Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.Location = New System.Drawing.Point(168, 16) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(48, 16) Me.Label2.TabIndex = 1 Me.Label2.Text = "1" ' 'Label3 ' Me.Label3.BackColor = System.Drawing.SystemColors.ControlText Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label3.Location = New System.Drawing.Point(128, 32) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(120, 1) Me.Label3.TabIndex = 2 '

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

'Label4 ' Me.Label4.BackColor = System.Drawing.Color.Transparent Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label4.Location = New System.Drawing.Point(128, 40) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(152, 24) Me.Label4.TabIndex = 3 Me.Label4.Text = "2/3 + 2/6 +....... + 2/N" ' 'Label5 ' Me.Label5.BackColor = System.Drawing.Color.Transparent Me.Label5.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label5.Location = New System.Drawing.Point(24, 88) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(128, 16) Me.Label5.TabIndex = 4 Me.Label5.Text = "Ingrese un Numero :" ' 'Label6 ' Me.Label6.BackColor = System.Drawing.Color.Transparent Me.Label6.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label6.Location = New System.Drawing.Point(24, 128) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(112, 24) Me.Label6.TabIndex = 5 Me.Label6.Text = "La Sumatoria es :" ' 'txtnumero ' Me.txtnumero.Location = New System.Drawing.Point(144, 88) Me.txtnumero.Name = "txtnumero" Me.txtnumero.Size = New System.Drawing.Size(72, 20) Me.txtnumero.TabIndex = 6 Me.txtnumero.Text = "" ' 'Txtsuma ' Me.Txtsuma.Location = New System.Drawing.Point(136, 128) Me.Txtsuma.Name = "Txtsuma" Me.Txtsuma.Size = New System.Drawing.Size(56, 20) Me.Txtsuma.TabIndex = 7 Me.Txtsuma.Text = "" ' 'btnCalcular ' Me.btnCalcular.BackColor = System.Drawing.SystemColors.ActiveBorder Me.btnCalcular.Location = New System.Drawing.Point(24, 176) Me.btnCalcular.Name = "btnCalcular" Me.btnCalcular.Size = New System.Drawing.Size(72, 24) Me.btnCalcular.TabIndex = 8 Me.btnCalcular.Text = "&Calcular"

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

' 'BtnNuevo ' Me.BtnNuevo.BackColor = System.Drawing.SystemColors.ActiveBorder Me.BtnNuevo.Location = New System.Drawing.Point(96, 176) Me.BtnNuevo.Name = "BtnNuevo" Me.BtnNuevo.Size = New System.Drawing.Size(72, 24) Me.BtnNuevo.TabIndex = 9 Me.BtnNuevo.Text = "&Nuevo" ' 'btnSalir ' Me.btnSalir.BackColor = System.Drawing.SystemColors.ActiveBorder Me.btnSalir.Location = New System.Drawing.Point(168, 176) Me.btnSalir.Name = "btnSalir" Me.btnSalir.Size = New System.Drawing.Size(64, 24) Me.btnSalir.TabIndex = 10 Me.btnSalir.Text = "&Salir" ' 'FrmSumatoria ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Bitmap) Me.ClientSize = New System.Drawing.Size(336, 229) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnSalir, Me.BtnNuevo, Me.btnCalcular, Me.Txtsuma, Me.txtnumero, Me.Label6, Me.Label5, Me.Label4, Me.Label3, Me.Label2, Me.Label1}) Me.Name = "FrmSumatoria" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Sumatoria" Me.ResumeLayout(False) End Sub #End Region Private Sub btnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcular.Click Dim n, i As Integer Dim suma, s As Double n = Val(Me.txtnumero.Text) s = 0 For i = 1 To n s = s + 1 / (3 * i) Next suma = Math.Round(1 / s, 3) Me.Txtsuma.Text = Str(suma) End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.txtnumero.Text = "" Me.Txtsuma.Text = "" Me.txtnumero.Focus() End Sub

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSalir.Click Me.Close() End Sub Private Sub txtnumero_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnumero.KeyPress Select Case e.KeyChar Case Chr(13) btnCalcular.Focus() End Select End Sub Private Sub FrmSumatoria_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

13.-

Dim postre, bebida, Entrada, Sopa, Segundo, total As Double Private Sub LstPostre_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles LstPostre.SelectedIndexChanged Select Case LstPostre.SelectedIndex Case 0 'Helado de Vainilla 'PictureBox2.Image = System.Drawing.Image.FromFile("C:\Fotos\Dibujo\12.jpg") postre = 10

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

'TxtCosto.Text = "10.00" Case 1 'Pure de Manzana 'PictureBox2.Image = System.Drawing.Image.FromFile("C:\Fotos\Dibujo\13.jpg") postre = 12 Case 2 'Torta Helada 'PictureBox2.Image = System.Drawing.Image.FromFile("C:\Fotos\Dibujo\14.jpg") postre = 15 End Select End Sub Private Sub BtnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalcular.Click If Me.ChkEntrada.Checked = True Then Entrada = 3 End If If Me.ChkSopa.Checked = True Then Sopa = 4 End If If Me.ChkSegundo.Checked = True Then Segundo = 6 End If If RbtnGaseosa.Checked = True Then bebida = 3 End If If RbtnVino.Checked = True Then bebida = 12 End If If RbtnCerveza.Checked = True Then bebida = 6 End If If RbtnCafe.Checked = True Then bebida = 1 End If total = Entrada + Sopa + Segundo + bebida + postre TxtTotal.Text = Str(total) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close() End Sub End Class

14.-

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Private Function operacion(ByVal x As Integer, ByVal y As Integer) Dim r, p, s, q As Double r = Math.Sqrt(x) q = Math.Round(r, 2) p = x ^ y s = x + y Me.TxtRaiz.Text = Str(r) Me.TxtPotencia.Text = Str(p) Me.TxtSuma.Text = Str(s) End Function Private Sub btncalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalcular.Click Dim x, y As Double x = Val(Me.txtn1.Text) y = Val(Me.txtn2.Text) operacion(x, y) End Sub Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click Me.txtn1.Text = "" Me.txtn2.Text = "" Me.TxtRaiz.Text = "" Me.TxtPotencia.Text = "" Me.TxtSuma.Text = "" Me.txtn1.Focus() End Sub Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click Me.Close()

End Sub

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

15.-

Private Sub BtnConvertir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnConvertir.Click Dim nUnidad, nDecena, nCentena, nMillar, nDecMillar, nCentMillar, nMillon, nDecMillon, nCentMillon, nMillarMillon, nDecMillarMillon, nCentMillarMillon, nBillon As Integer Dim cNumero As String Dim cNumText As String Dim nLen As Integer cNumero = Val(Me.TxtNumero.Text) 'Capturar el N cNumText = "" 'inicializamos la respuesta en nada nLen = Len(cNumero) 'Longitud del N 'Label3 = "Cifra de " & nLen & " dgitos" 'Realizar los clculos cNumero = Space(13 - nLen) + cNumero nUnidad = Val(Mid(cNumero, 13, 1)) nDecena = Val(Mid(cNumero, 12, 1)) nCentena = Val(Mid(cNumero, 11, 1)) nMillar = Val(Mid(cNumero, 10, 1)) nDecMillar = Val(Mid(cNumero, 9, 1)) nCentMillar = Val(Mid(cNumero, 8, 1)) nMillon = Val(Mid(cNumero, 7, 1)) nDecMillon = Val(Mid(cNumero, 6, 1)) nCentMillon = Val(Mid(cNumero, 5, 1)) nMillarMillon = Val(Mid(cNumero, 4, 1)) nDecMillarMillon = Val(Mid(cNumero, 3, 1)) nCentMillarMillon = Val(Mid(cNumero, 2, 1)) nBillon = Val(Mid(cNumero, 1, 1)) 'Escribir el N en letras If nBillon > 0 Then Select Case nBillon Case 1 cNumText = cNumText + " Un billn" Case 2 cNumText = cNumText + " Dos billones" Case 3 cNumText = cNumText + " Tres billones" Case 4 cNumText = cNumText + " Cuatro Billones" Case 5 cNumText = cNumText + " Cinco billones" Case 6

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

"to",

"", "

"", "

"", "

"", "

"", "

"", "

"", "

"", "

cNumText = cNumText + " Seis billones" Case 7 cNumText = cNumText + " Siete billones" Case 8 cNumText = cNumText + " Ocho billones" Case 9 cNumText = cNumText + " Nueve billones" End Select End If If nCentMillarMillon > 0 Then Select Case nCentMillarMillon Case 1 cNumText = cNumText + " Cien" cNumText = cNumText + IIf(nDecMillarMillon > 0, " mil millones") Case 2 cNumText = cNumText + " Doscientos" cNumText = cNumText + IIf(nDecMillarMillon > 0, mil millones") Case 3 cNumText = cNumText + " Trescientos" cNumText = cNumText + IIf(nDecMillarMillon > 0, mil millones") Case 4 cNumText = cNumText + " Cuatrocientos" cNumText = cNumText + IIf(nDecMillarMillon > 0, mil millones") Case 5 cNumText = cNumText + " Quinientos" cNumText = cNumText + IIf(nDecMillarMillon > 0, mil millones") Case 6 cNumText = cNumText + " Seiscientos" cNumText = cNumText + IIf(nDecMillarMillon > 0, mil millones") Case 7 cNumText = cNumText + " Setecientos" cNumText = cNumText + IIf(nDecMillarMillon > 0, mil millones") Case 8 cNumText = cNumText + " Ochocientos" cNumText = cNumText + IIf(nDecMillarMillon > 0, mil millones") Case 9 cNumText = cNumText + " Novecientos" cNumText = cNumText + IIf(nDecMillarMillon > 0, mil millones") End Select End If If nDecMillarMillon > 0 Then Select Case nDecMillarMillon Case 1 If nMillarMillon = 0 Then cNumText = cNumText + " diez mil millones" End If If nMillarMillon = 1 Then cNumText = cNumText + " once mil millones" nMillarMillon = 0 End If If nMillarMillon = 2 Then cNumText = cNumText + " doce mil millones"

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

"e

",

",

",

",

",

",

",

nMillarMillon = 0 End If If nMillarMillon = 3 Then cNumText = cNumText + " trece mil millones" nMillarMillon = 0 End If If nMillarMillon = 4 Then cNumText = cNumText + " catorce mil millones" nMillarMillon = 0 End If If nMillarMillon = 5 Then cNumText = cNumText + " quince mil millones" nMillarMillon = 0 End If If nMillarMillon > 5 Then cNumText = cNumText + " dieci" End If Case 2 cNumText = cNumText + " Veint" cNumText = cNumText + IIf(nMillarMillon > 0, "i", mil millones") Case 3 cNumText = cNumText + " Treint" cNumText = cNumText + IIf(nMillarMillon > 0, "a y "a mil millones") Case 4 cNumText = cNumText + " Cuarent" cNumText = cNumText + IIf(nMillarMillon > 0, "a y "a mil millones") Case 5 cNumText = cNumText + " Cincuent" cNumText = cNumText + IIf(nMillarMillon > 0, "a y "a mil millones") Case 6 cNumText = cNumText + " Sesent" cNumText = cNumText + IIf(nMillarMillon > 0, "a y "a mil millones") Case 7 cNumText = cNumText + " Setent" cNumText = cNumText + IIf(nMillarMillon > 0, "a y "a mil millones") Case 8 cNumText = cNumText + " Ochent" cNumText = cNumText + IIf(nMillarMillon > 0, "a y "a mil millones") Case 9 cNumText = cNumText + " novent" cNumText = cNumText + IIf(nMillarMillon > 0, "a y "a mil millones") End Select End If If nMillarMillon > 0 Then Select Case nMillarMillon Case 1 cNumText = cNumText + "un mil millones" Case 2 cNumText = cNumText + " dos mil millones" Case 3 cNumText = cNumText + " tres mil millones" Case 4 cNumText = cNumText + " cuatro mil millones"

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Case 5 cNumText = cNumText + " cinco mil millones" Case 6 cNumText = cNumText + "seis mil millones" Case 7 cNumText = cNumText + "siete mil millones" Case 8 cNumText = cNumText + "ocho mil millones" Case 9 cNumText = cNumText + "nueve mil millones" End Select End If If nCentMillon > 0 Then Select Case nCentMillon Case 1 cNumText = cNumText + " Cien" cNumText = cNumText + IIf(nDecMillon > 0, "to", " millones") Case 2 cNumText = cNumText + " Doscientos" cNumText = cNumText + IIf(nDecMillon > 0, "", " millones") Case 3 cNumText = cNumText + " Trescientos" cNumText = cNumText + IIf(nDecMillon > 0, "", " millones") Case 4 cNumText = cNumText + " Cuatrocientos" cNumText = cNumText + IIf(nDecMillon > 0, "", " millones") Case 5 cNumText = cNumText + " Quinientos" cNumText = cNumText + IIf(nDecMillon > 0, "", " millones") Case 6 cNumText = cNumText + " Seiscientos" cNumText = cNumText + IIf(nDecMillon > 0, "", " millones") Case 7 cNumText = cNumText + " Setecientos" cNumText = cNumText + IIf(nDecMillon > 0, "", " millones") Case 8 cNumText = cNumText + " Ochocientos" cNumText = cNumText + IIf(nDecMillon > 0, "", " millones") Case 9 cNumText = cNumText + " Novecientos" cNumText = cNumText + IIf(nDecMillon > 0, "", " millones") End Select End If If nDecMillon > 0 Then Select Case nDecMillon Case 1 If nMillon = 0 Then cNumText = cNumText + " diez millones" End If If nMillon = 1 Then cNumText = cNumText + " once millones" nMillon = 0

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

End If If nMillon = 2 Then cNumText = cNumText + " doce millones" nMillon = 0 End If If nMillon = 3 Then cNumText = cNumText + " trece millones" nMillon = 0 End If If nMillon = 4 Then cNumText = cNumText + " catorce millones" nMillon = 0 End If If nMillon = 5 Then cNumText = cNumText + " quince millones" nMillon = 0 End If If nMillon > 5 Then cNumText = cNumText + " dieci" End If Case 2 cNumText = cNumText + " Veint" cNumText = cNumText + IIf(nMillon > 0, "i", "e millones") Case 3 cNumText = cNumText + " Treint" cNumText = cNumText + IIf(nMillon > 0, "a y ", "a millones") Case 4 cNumText = cNumText + " Cuarent" cNumText = cNumText + IIf(nMillon > 0, "a y ", "a millones") Case 5 cNumText = cNumText + " Cincuent" cNumText = cNumText + IIf(nMillon > 0, "a y ", "a millones") Case 6 cNumText = cNumText + " Sesent" cNumText = cNumText + IIf(nMillon > 0, "a y ", "a millones") Case 7 cNumText = cNumText + " Setent" cNumText = cNumText + IIf(nMillon > 0, "a y ", "a millones") Case 8 cNumText = cNumText + " Ochent" cNumText = cNumText + IIf(nMillon > 0, "a y ", "a millones") Case 9 cNumText = cNumText + " novent" cNumText = cNumText + IIf(nMillon > 0, "a y ", "a millones") End Select End If If nMillon > 0 Then Select Case nMillon Case 1 cNumText = cNumText + " Un millones" Case 2 cNumText = cNumText + " Dos millones" Case 3

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I


+ " Tres millones" + " Cuatro millones" + " Cinco millones" + "Seis millones" + "Siete millones" + "ocho millones" + "Nueve millones"

cNumText = cNumText Case 4 cNumText = cNumText Case 5 cNumText = cNumText Case 6 cNumText = cNumText Case 7 cNumText = cNumText Case 8 cNumText = cNumText Case 9 cNumText = cNumText End Select End If If nCentMillar > 0 Then Select Case nCentMillar Case 1 cNumText = cNumText cNumText = cNumText "mil")

+ " Cien" + IIf(nDecMillar > 0, "to",

Case 2 cNumText = cNumText + " Doscientos" cNumText = cNumText + IIf(nDecMillar > 0, "", "mil") Case 3 cNumText = cNumText + " Trescientos" cNumText = cNumText + IIf(nDecMillar > 0, "", "mil") Case 4 cNumText = cNumText + " Cuatrocientos" cNumText = cNumText + IIf(nDecMillar > 0, "", "mil") Case 5 cNumText = cNumText + " Quinientos" cNumText = cNumText + IIf(nDecMillar > 0, "", "mil") Case 6 cNumText = cNumText + " Seiscientos" cNumText = cNumText + IIf(nDecMillar > 0, "", "mil") Case 7 cNumText = cNumText + " Setecientos" cNumText = cNumText + IIf(nDecMillar > 0, "", "mil") Case 8 cNumText = cNumText + " Ochocientos" cNumText = cNumText + IIf(nDecMillar > 0, "", "mil") Case 9 cNumText = cNumText + " Novecientos" cNumText = cNumText + IIf(nDecMillar > 0, "", "mil") End Select End If If nDecMillar > 0 Then Select Case nDecMillar Case 1 If nMillar = 0 Then cNumText = cNumText + " Diez mil" End If

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

If nMillar = 1 Then cNumText = cNumText + " Once mil" nMillar = 0 End If If nMillar = 2 Then cNumText = cNumText + " Doce mil" nMillar = 0 End If If nMillar = 3 Then cNumText = cNumText + " Trece mil" nMillar = 0 End If If nMillar = 4 Then cNumText = cNumText + " Catorce mil" nMillar = 0 End If If nMillar = 5 Then cNumText = cNumText + " Quince mil" nMillar = 0 End If If nMillar > 5 Then cNumText = cNumText + " Dieci" End If Case 2 cNumText = cNumText + " Veint" cNumText = cNumText + IIf(nMillar > 0, "i", "e mil") Case 3 cNumText = cNumText + " Treint" cNumText = cNumText + IIf(nMillar > 0, "a y ", "a mil") Case 4 cNumText = cNumText + " Cuarent" cNumText = cNumText + IIf(nMillar > 0, "a y ", "a mil") Case 5 cNumText = cNumText + " Cincuent" cNumText = cNumText + IIf(nMillar > 0, "a y ", "a mil") Case 6 cNumText = cNumText + " Sesent" cNumText = cNumText + IIf(nMillar > 0, "a y ", "a mil") Case 7 cNumText = cNumText + " Setent" cNumText = cNumText + IIf(nMillar > 0, "a y ", "a mil") Case 8 cNumText = cNumText + " Ochent" cNumText = cNumText + IIf(nMillar > 0, "a y ", "a mil") Case 9 cNumText = cNumText + " Novent" cNumText = cNumText + IIf(nMillar > 0, "a y ", "a mil") End Select End If If nMillar > 0 Then Select Case nMillar Case 1 cNumText = cNumText + "un mil"

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Case 2 cNumText = cNumText + " dos mil" Case 3 cNumText = cNumText + " tres mil" Case 4 cNumText = cNumText + " cuatro mil" Case 5 cNumText = cNumText + " cinco mil" Case 6 cNumText = cNumText + "seis mil" Case 7 cNumText = cNumText + "siete mil" Case 8 cNumText = cNumText + "ocho mil" Case 9 cNumText = cNumText + "nueve mil" End Select End If If nCentena > 0 Then Select Case nCentena Case 1 cNumText = cNumText + " Ciento" Case 2 cNumText = cNumText + " Doscientos" Case 3 cNumText = cNumText + " Trescientos" Case 4 cNumText = cNumText + " Cuatrocientos" Case 5 cNumText = cNumText + " Quinientos" Case 6 cNumText = cNumText + " Seiscientos" Case 7 cNumText = cNumText + " Setecientos" Case 8 cNumText = cNumText + " Ochocientos" Case 9 cNumText = cNumText + " Novecientos" End Select End If If nDecena > 0 Then Select Case nDecena Case 1 If nUnidad = 0 Then cNumText = cNumText + " Diez" End If If nUnidad = 1 Then cNumText = cNumText + " Once" nUnidad = 0 End If If nUnidad = 2 Then cNumText = cNumText + " Doce" nUnidad = 0 End If If nUnidad = 3 Then cNumText = cNumText + " Trece" nUnidad = 0 End If If nUnidad = 4 Then cNumText = cNumText + " Catorce" nUnidad = 0

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

End If If nUnidad = 5 Then cNumText = cNumText + " Quince" nUnidad = 0 End If If nUnidad > 5 Then cNumText = cNumText + " Dieci" End If Case 2 cNumText = cNumText + " Veint" cNumText = cNumText + IIf(nUnidad > Case 3 cNumText = cNumText + " Treint" cNumText = cNumText + IIf(nUnidad > Case 4 cNumText = cNumText + " Cuarent" cNumText = cNumText + IIf(nUnidad > Case 5 cNumText = cNumText + " Cincuent" cNumText = cNumText + IIf(nUnidad > Case 6 cNumText = cNumText + " Sesent" cNumText = cNumText + IIf(nUnidad > Case 7 cNumText = cNumText + " Setent" cNumText = cNumText + IIf(nUnidad > Case 8 cNumText = cNumText + " Ochent" cNumText = cNumText + IIf(nUnidad > Case 9 cNumText = cNumText + " Novent" cNumText = cNumText + IIf(nUnidad > End Select End If If nUnidad > 0 Then Select Case nUnidad Case 1 cNumText = cNumText + " uno" Case 2 cNumText = cNumText + " dos" Case 3 cNumText = cNumText + " tres" Case 4 cNumText = cNumText + " cuatro" Case 5 cNumText = cNumText + " cinco" Case 6 cNumText = cNumText + "seis" Case 7 cNumText = cNumText + "siete" Case 8 cNumText = cNumText + "ocho" Case 9 cNumText = cNumText + "nueve" End Select End If TxtLetras.Text = cNumText End Sub

0, "i", "e") 0, "a y", "a") 0, "a y", "a") 0, "a y", "a") 0, "a y", "a") 0, "a y", "a") 0, "a y", "a") 0, "a y", "a")

Private Sub TxtNumero_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtNumero.KeyPress

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Select Case e.KeyChar Case Chr(13) BtnConvertir.Focus() End Select End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.TxtLetras.Text = "" Me.TxtNumero.Text = "" TxtNumero.Focus() End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub End Class

16.-

Private Sub btnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcular.Click Dim a, b, c, x, z As Integer a = Val(Me.txtnumedif.Text) b = (a - 1) c = (b * 15) z = (c + 10) Me.txtresultado.Text = Str(z) End Sub Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSalir.Click Me.Close() End Sub End Class

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

17.-

Dim num(100) As Integer Private Sub BtnCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalcular.Click Dim n, i As Integer n = Val(TxtNumero.Text) num(0) = 0 num(1) = 1 For i = 2 To n + 2 num(i) = num(i - 1) * 2 + num(i - 2) Next i For i = 1 To n Me.ListBox1.Items.Add(num(i)) Next BtnNuevo.Focus() End Sub Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click Me.Close() End Sub Private Sub BtnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNuevo.Click Me.TxtNumero.Clear() Me.ListBox1.Items.Clear() Me.TxtNumero.Focus() End Sub Private Sub TxtNumero_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtNumero.KeyPress Select Case e.KeyChar Case Chr(13) BtnCalcular.Focus() End Select End Sub End Class

Universidad Nacional Jorge Basadre Grohmann-ITEL


Carrera: Tcnico Analista Programador de Sistemas

Curso: Programacin Visual.Net I

Otro formulario

Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.Label2.Text = TimeString End Sub Private Sub Frmreloj_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 Me.Close() End Sub End Class

You might also like