' REME CALC --- calculadora --- 11 de Mayo de 2003

' para usar la función Math.Sign
Imports System.Math

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Código generado por el Diseñador de Windows Forms "

    Public Sub New()
        MyBase.New()

        'El Diseñador de Windows Forms requiere esta llamada.
        InitializeComponent()

        'Agregar cualquier inicialización después 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 Diseñador de Windows Forms
    Private components As System.ComponentModel.IContainer

    'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
    'Puede modificarse utilizando el Diseñador de Windows Forms. 
    'No lo modifique con el editor de código.
    Friend WithEvents pictReme As System.Windows.Forms.PictureBox
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents bt1 As System.Windows.Forms.Button
    Friend WithEvents bt2 As System.Windows.Forms.Button
    Friend WithEvents bt3 As System.Windows.Forms.Button
    Friend WithEvents bt4 As System.Windows.Forms.Button
    Friend WithEvents bt5 As System.Windows.Forms.Button
    Friend WithEvents bt6 As System.Windows.Forms.Button
    Friend WithEvents bt7 As System.Windows.Forms.Button
    Friend WithEvents bt8 As System.Windows.Forms.Button
    Friend WithEvents bt9 As System.Windows.Forms.Button
    Friend WithEvents bt0 As System.Windows.Forms.Button
    Friend WithEvents btSigno As System.Windows.Forms.Button
    Friend WithEvents btPunto As System.Windows.Forms.Button
    Friend WithEvents btSuma As System.Windows.Forms.Button
    Friend WithEvents btResta As System.Windows.Forms.Button
    Friend WithEvents btMultiplica As System.Windows.Forms.Button
    Friend WithEvents btDivide As System.Windows.Forms.Button
    Friend WithEvents btCuadrado As System.Windows.Forms.Button
    Friend WithEvents btIgual As System.Windows.Forms.Button
    Friend WithEvents btApagado As System.Windows.Forms.Button
    Friend WithEvents btMC As System.Windows.Forms.Button
    Friend WithEvents btMS As System.Windows.Forms.Button
    Friend WithEvents btMR As System.Windows.Forms.Button
    Friend WithEvents btRetro As System.Windows.Forms.Button
    Friend WithEvents menuCodigo As System.Windows.Forms.MenuItem
    Friend WithEvents menuSalir As System.Windows.Forms.MenuItem
    Friend WithEvents btAcero As System.Windows.Forms.Button
    Friend WithEvents txtPantalla As System.Windows.Forms.TextBox
    Friend WithEvents btSqrt As System.Windows.Forms.Button
    Friend WithEvents Panel2 As System.Windows.Forms.Panel
    Friend WithEvents Panel1 As System.Windows.Forms.Panel
    Friend WithEvents Panel4 As System.Windows.Forms.Panel
    Friend WithEvents txtHora As System.Windows.Forms.TextBox
    Friend WithEvents btC As System.Windows.Forms.Button
    Friend WithEvents Panel3 As System.Windows.Forms.Panel
    Friend WithEvents menuCalculadora As System.Windows.Forms.MenuItem
    Friend WithEvents Panel5 As System.Windows.Forms.Panel
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.bt1 = New System.Windows.Forms.Button
        Me.bt2 = New System.Windows.Forms.Button
        Me.bt3 = New System.Windows.Forms.Button
        Me.bt4 = New System.Windows.Forms.Button
        Me.bt5 = New System.Windows.Forms.Button
        Me.bt6 = New System.Windows.Forms.Button
        Me.bt7 = New System.Windows.Forms.Button
        Me.bt8 = New System.Windows.Forms.Button
        Me.bt9 = New System.Windows.Forms.Button
        Me.bt0 = New System.Windows.Forms.Button
        Me.btSigno = New System.Windows.Forms.Button
        Me.btPunto = New System.Windows.Forms.Button
        Me.btSuma = New System.Windows.Forms.Button
        Me.btResta = New System.Windows.Forms.Button
        Me.btMultiplica = New System.Windows.Forms.Button
        Me.btDivide = New System.Windows.Forms.Button
        Me.btCuadrado = New System.Windows.Forms.Button
        Me.btSqrt = New System.Windows.Forms.Button
        Me.btIgual = New System.Windows.Forms.Button
        Me.btApagado = New System.Windows.Forms.Button
        Me.btAcero = New System.Windows.Forms.Button
        Me.txtPantalla = New System.Windows.Forms.TextBox
        Me.btMC = New System.Windows.Forms.Button
        Me.btMS = New System.Windows.Forms.Button
        Me.btMR = New System.Windows.Forms.Button
        Me.btRetro = New System.Windows.Forms.Button
        Me.pictReme = New System.Windows.Forms.PictureBox
        Me.MainMenu1 = New System.Windows.Forms.MainMenu
        Me.menuCalculadora = New System.Windows.Forms.MenuItem
        Me.menuCodigo = New System.Windows.Forms.MenuItem
        Me.menuSalir = New System.Windows.Forms.MenuItem
        Me.Panel2 = New System.Windows.Forms.Panel
        Me.btC = New System.Windows.Forms.Button
        Me.Panel3 = New System.Windows.Forms.Panel
        Me.Panel1 = New System.Windows.Forms.Panel
        Me.Panel4 = New System.Windows.Forms.Panel
        Me.txtHora = New System.Windows.Forms.TextBox
        Me.Panel5 = New System.Windows.Forms.Panel
        Me.Panel2.SuspendLayout()
        Me.Panel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'bt1
        '
        Me.bt1.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt1.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt1.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt1.Location = New System.Drawing.Point(8, 8)
        Me.bt1.Name = "bt1"
        Me.bt1.Size = New System.Drawing.Size(32, 32)
        Me.bt1.TabIndex = 1
        Me.bt1.TabStop = False
        Me.bt1.Text = "1"
        '
        'bt2
        '
        Me.bt2.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt2.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt2.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt2.Location = New System.Drawing.Point(48, 8)
        Me.bt2.Name = "bt2"
        Me.bt2.Size = New System.Drawing.Size(32, 32)
        Me.bt2.TabIndex = 2
        Me.bt2.TabStop = False
        Me.bt2.Text = "2"
        '
        'bt3
        '
        Me.bt3.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt3.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt3.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt3.Location = New System.Drawing.Point(88, 8)
        Me.bt3.Name = "bt3"
        Me.bt3.Size = New System.Drawing.Size(32, 32)
        Me.bt3.TabIndex = 3
        Me.bt3.TabStop = False
        Me.bt3.Text = "3"
        '
        'bt4
        '
        Me.bt4.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt4.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt4.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt4.Location = New System.Drawing.Point(128, 8)
        Me.bt4.Name = "bt4"
        Me.bt4.Size = New System.Drawing.Size(32, 32)
        Me.bt4.TabIndex = 4
        Me.bt4.TabStop = False
        Me.bt4.Text = "4"
        '
        'bt5
        '
        Me.bt5.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt5.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt5.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt5.Location = New System.Drawing.Point(168, 8)
        Me.bt5.Name = "bt5"
        Me.bt5.Size = New System.Drawing.Size(32, 32)
        Me.bt5.TabIndex = 5
        Me.bt5.TabStop = False
        Me.bt5.Text = "5"
        '
        'bt6
        '
        Me.bt6.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt6.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt6.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt6.Location = New System.Drawing.Point(8, 48)
        Me.bt6.Name = "bt6"
        Me.bt6.Size = New System.Drawing.Size(32, 32)
        Me.bt6.TabIndex = 7
        Me.bt6.TabStop = False
        Me.bt6.Text = "6"
        '
        'bt7
        '
        Me.bt7.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt7.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt7.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt7.Location = New System.Drawing.Point(48, 48)
        Me.bt7.Name = "bt7"
        Me.bt7.Size = New System.Drawing.Size(32, 32)
        Me.bt7.TabIndex = 8
        Me.bt7.TabStop = False
        Me.bt7.Text = "7"
        '
        'bt8
        '
        Me.bt8.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt8.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt8.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt8.Location = New System.Drawing.Point(88, 48)
        Me.bt8.Name = "bt8"
        Me.bt8.Size = New System.Drawing.Size(32, 32)
        Me.bt8.TabIndex = 9
        Me.bt8.TabStop = False
        Me.bt8.Text = "8"
        '
        'bt9
        '
        Me.bt9.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt9.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt9.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt9.Location = New System.Drawing.Point(128, 48)
        Me.bt9.Name = "bt9"
        Me.bt9.Size = New System.Drawing.Size(32, 32)
        Me.bt9.TabIndex = 10
        Me.bt9.TabStop = False
        Me.bt9.Text = "9"
        '
        'bt0
        '
        Me.bt0.Cursor = System.Windows.Forms.Cursors.Default
        Me.bt0.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.bt0.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bt0.Location = New System.Drawing.Point(168, 48)
        Me.bt0.Name = "bt0"
        Me.bt0.Size = New System.Drawing.Size(32, 32)
        Me.bt0.TabIndex = 11
        Me.bt0.TabStop = False
        Me.bt0.Text = "0"
        '
        'btSigno
        '
        Me.btSigno.Cursor = System.Windows.Forms.Cursors.Default
        Me.btSigno.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btSigno.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btSigno.Location = New System.Drawing.Point(168, 88)
        Me.btSigno.Name = "btSigno"
        Me.btSigno.Size = New System.Drawing.Size(32, 32)
        Me.btSigno.TabIndex = 17
        Me.btSigno.TabStop = False
        Me.btSigno.Text = "+/-"
        '
        'btPunto
        '
        Me.btPunto.Cursor = System.Windows.Forms.Cursors.Default
        Me.btPunto.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btPunto.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btPunto.Location = New System.Drawing.Point(208, 48)
        Me.btPunto.Name = "btPunto"
        Me.btPunto.Size = New System.Drawing.Size(32, 32)
        Me.btPunto.TabIndex = 12
        Me.btPunto.TabStop = False
        Me.btPunto.Text = ","
        '
        'btSuma
        '
        Me.btSuma.Cursor = System.Windows.Forms.Cursors.Default
        Me.btSuma.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btSuma.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btSuma.Location = New System.Drawing.Point(8, 88)
        Me.btSuma.Name = "btSuma"
        Me.btSuma.Size = New System.Drawing.Size(32, 32)
        Me.btSuma.TabIndex = 13
        Me.btSuma.TabStop = False
        Me.btSuma.Text = "+"
        '
        'btResta
        '
        Me.btResta.Cursor = System.Windows.Forms.Cursors.Default
        Me.btResta.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btResta.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btResta.Location = New System.Drawing.Point(48, 88)
        Me.btResta.Name = "btResta"
        Me.btResta.Size = New System.Drawing.Size(32, 32)
        Me.btResta.TabIndex = 14
        Me.btResta.TabStop = False
        Me.btResta.Text = "-"
        '
        'btMultiplica
        '
        Me.btMultiplica.Cursor = System.Windows.Forms.Cursors.Default
        Me.btMultiplica.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btMultiplica.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btMultiplica.Location = New System.Drawing.Point(88, 88)
        Me.btMultiplica.Name = "btMultiplica"
        Me.btMultiplica.Size = New System.Drawing.Size(32, 32)
        Me.btMultiplica.TabIndex = 15
        Me.btMultiplica.TabStop = False
        Me.btMultiplica.Text = "*"
        '
        'btDivide
        '
        Me.btDivide.Cursor = System.Windows.Forms.Cursors.Default
        Me.btDivide.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btDivide.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btDivide.Location = New System.Drawing.Point(128, 88)
        Me.btDivide.Name = "btDivide"
        Me.btDivide.Size = New System.Drawing.Size(32, 32)
        Me.btDivide.TabIndex = 16
        Me.btDivide.TabStop = False
        Me.btDivide.Text = "/"
        '
        'btCuadrado
        '
        Me.btCuadrado.Cursor = System.Windows.Forms.Cursors.Default
        Me.btCuadrado.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btCuadrado.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btCuadrado.Location = New System.Drawing.Point(56, 128)
        Me.btCuadrado.Name = "btCuadrado"
        Me.btCuadrado.Size = New System.Drawing.Size(40, 32)
        Me.btCuadrado.TabIndex = 20
        Me.btCuadrado.TabStop = False
        Me.btCuadrado.Text = "Pow"
        '
        'btSqrt
        '
        Me.btSqrt.Cursor = System.Windows.Forms.Cursors.Default
        Me.btSqrt.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btSqrt.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btSqrt.Location = New System.Drawing.Point(8, 128)
        Me.btSqrt.Name = "btSqrt"
        Me.btSqrt.Size = New System.Drawing.Size(40, 32)
        Me.btSqrt.TabIndex = 19
        Me.btSqrt.TabStop = False
        Me.btSqrt.Text = "Sqrt"
        '
        'btIgual
        '
        Me.btIgual.Cursor = System.Windows.Forms.Cursors.Default
        Me.btIgual.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btIgual.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btIgual.Location = New System.Drawing.Point(208, 128)
        Me.btIgual.Name = "btIgual"
        Me.btIgual.Size = New System.Drawing.Size(32, 32)
        Me.btIgual.TabIndex = 0
        Me.btIgual.TabStop = False
        Me.btIgual.Text = "="
        '
        'btApagado
        '
        Me.btApagado.Cursor = System.Windows.Forms.Cursors.Hand
        Me.btApagado.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btApagado.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btApagado.Location = New System.Drawing.Point(320, 8)
        Me.btApagado.Name = "btApagado"
        Me.btApagado.Size = New System.Drawing.Size(160, 32)
        Me.btApagado.TabIndex = 1
        Me.btApagado.TabStop = False
        Me.btApagado.Text = "Apaga y vámonos"
        '
        'btAcero
        '
        Me.btAcero.Cursor = System.Windows.Forms.Cursors.Hand
        Me.btAcero.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btAcero.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btAcero.Location = New System.Drawing.Point(192, 8)
        Me.btAcero.Name = "btAcero"
        Me.btAcero.Size = New System.Drawing.Size(120, 32)
        Me.btAcero.TabIndex = 0
        Me.btAcero.TabStop = False
        Me.btAcero.Text = "Poner a cero"
        '
        'txtPantalla
        '
        Me.txtPantalla.Font = New System.Drawing.Font("Verdana", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtPantalla.Location = New System.Drawing.Point(8, 8)
        Me.txtPantalla.MaxLength = 12
        Me.txtPantalla.Name = "txtPantalla"
        Me.txtPantalla.Size = New System.Drawing.Size(248, 31)
        Me.txtPantalla.TabIndex = 0
        Me.txtPantalla.Text = ""
        Me.txtPantalla.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        Me.txtPantalla.WordWrap = False
        '
        'btMC
        '
        Me.btMC.Cursor = System.Windows.Forms.Cursors.Default
        Me.btMC.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btMC.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btMC.Location = New System.Drawing.Point(104, 8)
        Me.btMC.Name = "btMC"
        Me.btMC.Size = New System.Drawing.Size(40, 32)
        Me.btMC.TabIndex = 4
        Me.btMC.TabStop = False
        Me.btMC.Text = "MC"
        '
        'btMS
        '
        Me.btMS.Cursor = System.Windows.Forms.Cursors.Default
        Me.btMS.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btMS.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btMS.Location = New System.Drawing.Point(8, 8)
        Me.btMS.Name = "btMS"
        Me.btMS.Size = New System.Drawing.Size(40, 32)
        Me.btMS.TabIndex = 2
        Me.btMS.TabStop = False
        Me.btMS.Text = "MS"
        '
        'btMR
        '
        Me.btMR.Cursor = System.Windows.Forms.Cursors.Default
        Me.btMR.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btMR.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btMR.Location = New System.Drawing.Point(56, 8)
        Me.btMR.Name = "btMR"
        Me.btMR.Size = New System.Drawing.Size(40, 32)
        Me.btMR.TabIndex = 3
        Me.btMR.TabStop = False
        Me.btMR.Text = "MR"
        '
        'btRetro
        '
        Me.btRetro.Cursor = System.Windows.Forms.Cursors.Default
        Me.btRetro.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btRetro.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btRetro.Location = New System.Drawing.Point(104, 128)
        Me.btRetro.Name = "btRetro"
        Me.btRetro.Size = New System.Drawing.Size(96, 32)
        Me.btRetro.TabIndex = 21
        Me.btRetro.TabStop = False
        Me.btRetro.Text = "Retroceso"
        '
        'pictReme
        '
        Me.pictReme.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.pictReme.Image = CType(resources.GetObject("pictReme.Image"), System.Drawing.Image)
        Me.pictReme.Location = New System.Drawing.Point(288, 48)
        Me.pictReme.Name = "pictReme"
        Me.pictReme.Size = New System.Drawing.Size(208, 168)
        Me.pictReme.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.pictReme.TabIndex = 24
        Me.pictReme.TabStop = False
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuCalculadora, Me.menuCodigo, Me.menuSalir})
        '
        'menuCalculadora
        '
        Me.menuCalculadora.Index = 0
        Me.menuCalculadora.Text = "Diseño Calculadora de Windows"
        '
        'menuCodigo
        '
        Me.menuCodigo.Index = 1
        Me.menuCodigo.Text = "Código del programa"
        '
        'menuSalir
        '
        Me.menuSalir.Index = 2
        Me.menuSalir.Text = "Salir del programa"
        '
        'Panel2
        '
        Me.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel2.Controls.Add(Me.btC)
        Me.Panel2.Controls.Add(Me.bt2)
        Me.Panel2.Controls.Add(Me.bt3)
        Me.Panel2.Controls.Add(Me.bt4)
        Me.Panel2.Controls.Add(Me.bt5)
        Me.Panel2.Controls.Add(Me.bt6)
        Me.Panel2.Controls.Add(Me.bt7)
        Me.Panel2.Controls.Add(Me.bt1)
        Me.Panel2.Controls.Add(Me.bt8)
        Me.Panel2.Controls.Add(Me.bt9)
        Me.Panel2.Controls.Add(Me.bt0)
        Me.Panel2.Controls.Add(Me.btSigno)
        Me.Panel2.Controls.Add(Me.btSuma)
        Me.Panel2.Controls.Add(Me.btResta)
        Me.Panel2.Controls.Add(Me.btMultiplica)
        Me.Panel2.Controls.Add(Me.btDivide)
        Me.Panel2.Controls.Add(Me.btIgual)
        Me.Panel2.Controls.Add(Me.btSqrt)
        Me.Panel2.Controls.Add(Me.btCuadrado)
        Me.Panel2.Controls.Add(Me.btRetro)
        Me.Panel2.Controls.Add(Me.Panel3)
        Me.Panel2.Controls.Add(Me.btPunto)
        Me.Panel2.Location = New System.Drawing.Point(8, 48)
        Me.Panel2.Name = "Panel2"
        Me.Panel2.Size = New System.Drawing.Size(248, 168)
        Me.Panel2.TabIndex = 1
        '
        'btC
        '
        Me.btC.Cursor = System.Windows.Forms.Cursors.Default
        Me.btC.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btC.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btC.Location = New System.Drawing.Point(208, 88)
        Me.btC.Name = "btC"
        Me.btC.Size = New System.Drawing.Size(32, 32)
        Me.btC.TabIndex = 18
        Me.btC.TabStop = False
        Me.btC.Text = "C"
        '
        'Panel3
        '
        Me.Panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel3.Location = New System.Drawing.Point(208, 8)
        Me.Panel3.Name = "Panel3"
        Me.Panel3.Size = New System.Drawing.Size(32, 32)
        Me.Panel3.TabIndex = 6
        '
        'Panel1
        '
        Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel1.Controls.Add(Me.btMR)
        Me.Panel1.Controls.Add(Me.btMS)
        Me.Panel1.Controls.Add(Me.Panel4)
        Me.Panel1.Controls.Add(Me.btAcero)
        Me.Panel1.Controls.Add(Me.btApagado)
        Me.Panel1.Controls.Add(Me.btMC)
        Me.Panel1.Location = New System.Drawing.Point(8, 224)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(488, 48)
        Me.Panel1.TabIndex = 2
        '
        'Panel4
        '
        Me.Panel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel4.Location = New System.Drawing.Point(152, 8)
        Me.Panel4.Name = "Panel4"
        Me.Panel4.Size = New System.Drawing.Size(32, 32)
        Me.Panel4.TabIndex = 5
        '
        'txtHora
        '
        Me.txtHora.BackColor = System.Drawing.SystemColors.Control
        Me.txtHora.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.txtHora.Cursor = System.Windows.Forms.Cursors.Default
        Me.txtHora.Font = New System.Drawing.Font("Arial", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtHora.ForeColor = System.Drawing.Color.FromArgb(CType(64, Byte), CType(64, Byte), CType(64, Byte))
        Me.txtHora.Location = New System.Drawing.Point(264, 16)
        Me.txtHora.Name = "txtHora"
        Me.txtHora.ReadOnly = True
        Me.txtHora.Size = New System.Drawing.Size(232, 15)
        Me.txtHora.TabIndex = 1
        Me.txtHora.TabStop = False
        Me.txtHora.Text = ""
        Me.txtHora.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        Me.txtHora.WordWrap = False
        '
        'Panel5
        '
        Me.Panel5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Panel5.Location = New System.Drawing.Point(264, 48)
        Me.Panel5.Name = "Panel5"
        Me.Panel5.Size = New System.Drawing.Size(16, 168)
        Me.Panel5.TabIndex = 25
        '
        'Form1
        '
        Me.AcceptButton = Me.btIgual
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(502, 276)
        Me.Controls.Add(Me.Panel5)
        Me.Controls.Add(Me.txtHora)
        Me.Controls.Add(Me.pictReme)
        Me.Controls.Add(Me.txtPantalla)
        Me.Controls.Add(Me.Panel2)
        Me.Controls.Add(Me.Panel1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.Menu = Me.MainMenu1
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        Me.Text = "Reme CALC - Versión 1"
        Me.Panel2.ResumeLayout(False)
        Me.Panel1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    ' Variables a nivel de clase
    Dim Memoria As Double ' Para operaciones de las teclas M
    Dim Resultado As Double ' Resultado de la operación
    Dim Operador As String ' Operador que hemos tecleado
    Dim tocaBorrar As Boolean ' Para saber si hemos pulsado un operador + - * /

    ' Salto de línea para usar en los cuadros de diálogo
    Dim saltoLinea As Char = Chr(13) & Chr(10) ' equivale a vbCrLf

    ' Procedimiento que coloca el cursor a la derecha
    '  de la pantalla del resultado, para añadir dígitos
    Private Sub pantallaCursor()
        txtPantalla.Focus() ' da el foco a la pantalla
        txtPantalla.SelectionStart = 12 ' coloca el cursor a la derecha del todo
        txtPantalla.SelectionLength = 0 ' selección de cero caracteres
    End Sub

    ' mostrar la fecha en el control de texto txtHora
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Top = 50 ' posición y del formulario
        Me.Left = (Screen.PrimaryScreen.WorkingArea.Width - Me.Width) \ 2 ' posición x del formulario
        Dim Fecha As Date ' variable de tipo fecha
        Fecha = Now()
        ' doy formato a fecha y pongo en mayúscula la primera letra de cada palabra
        txtHora.Text = StrConv((Format(Fecha, "dddd, dd/ MMMM/yyyy, HH:mm ")), VbStrConv.ProperCase)
    End Sub

    ' Capturar la tecla pulsada cuando el foco está en la pantalla de resultado
    Private Sub txtPantalla_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPantalla.KeyPress
        Select Case e.KeyChar ' según el valor de la tecla pulsada
            ' pasan valores si la tecla pulsada es un número de 0 a 9
        Case "1"c, "2"c, "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, "9"c, "0"c
                e.Handled = False
                '    ' si la propiedad Handled del objeto e se pone a True indico
                '    ' que la tecla ha sido "manejada" por el evento, equivale a
                '    ' indicar que la tecla no ha sido pulsada, pero si la propiedad 
                '    ' Handled del objeto e se pone a False indico que la tecla
                '    ' todavía no ha sido "manejada" por el evento y se envía.
            Case Else ' en los demás casos, no se pasa la pulsación
                e.Handled = True
        End Select
    End Sub

    ' Pulsar un botón de número 0 a 9
    Private Sub bt1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt1.Click, bt0.Click, bt2.Click, bt3.Click, bt4.Click, bt5.Click, bt6.Click, bt7.Click, bt8.Click, bt9.Click, btPunto.Click
        ' si la pantalla tiene menos de 13 caracteres escribo otro
        If tocaBorrar = False Then
            If txtPantalla.Text.Length < 12 Then
                txtPantalla.Text = txtPantalla.Text & sender.Text
                ' Para 'Introducir solamente una coma (separador decimal):
                ' la primera coma es valorada como formando parte del número
                ' la segunda coma es valorada como un carácter no numérico
                If Not IsNumeric(txtPantalla.Text) Then
                    If txtPantalla.Text <> "" Then ' si la pantalla NO está vacía
                        ' elimino el último carácter de la cadena, que es el último escrito
                        txtPantalla.Text = txtPantalla.Text.Remove(txtPantalla.Text.Length - 1, 1)
                        ' si escribo algo pero no es un número en una pantalla que SI está vacía
                        'ElseIf txtPantalla.Text.Length = 0 Then
                        '    txtPantalla.Text = ""
                    End If
                End If
            ElseIf txtPantalla.Text.Length = 12 Then ' si ya hay 12 caracteres
                MessageBox.Show("Ya hay 12 números en la pantalla." & saltoLinea & "Es suficiente por ahora.", "Más de 12 NO", MessageBoxButtons.OK)
            ElseIf txtPantalla.Text = "" Then ' si no hay nada escrito en la pantalla
                txtPantalla.Text = sender.Text
            End If
        Else
            txtPantalla.Text = sender.Text
            If Not IsNumeric(txtPantalla.Text) Then ' si escribo una coma
                txtPantalla.Text = "" ' pantalla vacía
            End If
            tocaBorrar = False
        End If
        pantallaCursor() ' cursor colocado para escribir de nuevo
    End Sub

    ' Operación matemática que estoy haciendo
    Private Sub Calcular()
        Select Case Operador ' operador en uso
            Case ""
                If txtPantalla.Text.Length > 0 Then
                    Resultado = txtPantalla.Text
                Else ' si la pantalla está vacía
                    Resultado = 0.0 ' simplemente pongo Resultado a cero
                End If
            Case "+"
                If txtPantalla.Text.Length > 0 Then
                    Resultado = Resultado + txtPantalla.Text
                Else ' si la pantalla está vacía
                    Resultado = 0.0 ' simplemente pongo Resultado a cero
                End If
            Case "-"
                If txtPantalla.Text.Length > 0 Then
                    Resultado = Resultado - txtPantalla.Text
                Else ' si la pantalla está vacía
                    Resultado = 0.0 ' simplemente pongo Resultado a cero
                End If
            Case "*"
                If txtPantalla.Text.Length > 0 Then
                    Resultado = Resultado * txtPantalla.Text
                Else ' si la pantalla está vacía
                    Resultado = 0.0 ' simplemente pongo Resultado a cero
                End If
            Case "/"
                If txtPantalla.Text.Length > 0 Then
                    Resultado = Resultado / txtPantalla.Text
                Else ' si la pantalla está vacía
                    Resultado = 0.0 ' simplemente pongo Resultado a cero
                End If
        End Select
        txtPantalla.Text = Math.Round(Resultado, 3)
        tocaBorrar = True ' para llevar acumulada la operación
    End Sub

    ' Botón de suma
    Private Sub btSuma_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSuma.Click
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            Calcular() ' operación pendiente
            txtPantalla.Text = ""
            Operador = "+" ' operador pendiente
        Else ' si la pantalla está vacía
            Resultado = 0.0 ' simplemente pongo Resultado a cero
            pantallaCursor() ' cursor colocado para escribir de nuevo
        End If
    End Sub

    ' Botón de resta
    Private Sub btResta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btResta.Click
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            Calcular() ' operación pendiente
            txtPantalla.Text = ""
            Operador = "-" ' operador pendiente
        Else ' si la pantalla está vacía
            Resultado = 0.0 ' simplemente pongo Resultado a cero
            pantallaCursor() ' cursor colocado para escribir de nuevo
        End If
    End Sub

    ' Botón de multiplicación
    Private Sub btMultiplica_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btMultiplica.Click
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            Calcular() ' operación pendiente
            txtPantalla.Text = ""
            Operador = "*" ' operador pendiente
        Else ' si la pantalla está vacía
            Resultado = 0.0 ' simplemente pongo Resultado a cero
            pantallaCursor() ' cursor colocado para escribir de nuevo
        End If
    End Sub

    ' Botón de división
    Private Sub btDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btDivide.Click
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            Calcular() ' operación pendiente
            txtPantalla.Text = ""
            Operador = "/" ' operador pendiente
        Else ' si la pantalla está vacía
            Resultado = 0.0 ' simplemente pongo Resultado a cero
            pantallaCursor() ' cursor colocado para escribir de nuevo
        End If
    End Sub

    ' Botón de potencia
    Private Sub btCuadrado_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btCuadrado.Click
        Dim prov1 As Double
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            prov1 = Math.Pow(txtPantalla.Text, 2) ' calculo la potencia de 2
            txtPantalla.Text = Math.Round(prov1, 3) ' redondeo a 3 decimales
            ' para interrumpir los cálculos de números muy grandes
            Dim encontrarE As Integer ' busco la letra E en la pantalla
            encontrarE = txtPantalla.Text.IndexOf("E")
            ' devuelve el índice que ocupa en la cadena o menos uno si no existe
            If encontrarE >= 0 Then
                MessageBox.Show("El número ya es muy grande, ¿no?" & saltoLinea & "Vamos a empezar de nuevo.", "Número grande NO", MessageBoxButtons.OK)
                txtPantalla.Text = ""
            End If
        Else ' si la pantalla está vacía
            Resultado = 0.0 ' simplemente pongo Resultado a cero
            pantallaCursor() ' cursor colocado para escribir de nuevo
        End If
    End Sub

    ' Botón de cambio de signo
    Private Sub btSigno_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSigno.Click
        ' si pulso Cambio de signo con pantalla vacía
        If txtPantalla.Text.Length = 0 Then
            txtPantalla.Text = ""
        Else ' si pulso Cambio de signo con algún dígito en la pantalla
            If Sign(CDbl(txtPantalla.Text)) = -1 Then ' si es número negativo
                ' quito el signo - (primer carácter)
                txtPantalla.Text = txtPantalla.Text.Remove(0, 1)
            ElseIf Sign(CDbl(txtPantalla.Text)) = 1 Then  ' si es número positivo
                ' añado el signo menos al principio
                txtPantalla.Text = "-" & txtPantalla.Text
            End If
        End If
        pantallaCursor() ' cursor colocado para escribir de nuevo
    End Sub

    ' Botón de raíz cuadrada
    Private Sub btSqrt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSqrt.Click
        Dim prov3 As Double
        If txtPantalla.Text = "" Then ' si la pantalla está vacía
            Resultado = 0.0 ' simplemente pongo Resultado a cero
            pantallaCursor() ' cursor colocado para escribir de nuevo
        End If
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            If Sign(CDbl(txtPantalla.Text)) = -1 Then  ' si es número negativo
                txtPantalla.Text = txtPantalla.Text.Remove(0, 1)  ' quito el signo - (primer carácter)
            ElseIf Sign(CDbl(txtPantalla.Text)) = 1 Then ' si es número positivo
            End If
            prov3 = Math.Sqrt(txtPantalla.Text) ' calculo la raíz cuadrada
            txtPantalla.Text = Math.Round(prov3, 3) ' redondeo a 3 decimales
        End If
    End Sub

    ' Botón retroceso
    Private Sub btRetro_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btRetro.Click
        If Not txtPantalla.Text = "" Then ' si la pantalla no está vacía
            If txtPantalla.Text.Length > 2 Then ' si quedan más de 2 caracteres
                txtPantalla.Text = txtPantalla.Text.Remove(txtPantalla.Text.Length - 1, 1)
            ElseIf txtPantalla.Text.Length = 1 Then ' si queda un único carácter
                txtPantalla.Text = ""
            Else ' si quedan 2 caracteres
                If Sign(CDbl(txtPantalla.Text)) = -1 Then ' si es número negativo
                    txtPantalla.Text = ""
                    ' si se trata de un cero y una coma
                ElseIf txtPantalla.Text = "0," Then
                    txtPantalla.Text = ""
                Else
                    txtPantalla.Text = txtPantalla.Text.Remove(1, 1)
                End If
            End If
        Else ' si la pantalla está vacía
            MessageBox.Show("La pantalla está vacía." & saltoLinea & "No sigas pulsando Retroceso.", "Retroceso NO", MessageBoxButtons.OK)
        End If
        pantallaCursor() ' cursor colocado para escribir de nuevo
    End Sub

    ' Botón de resultado: =
    Private Sub btIgual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btIgual.Click
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            Calcular() ' operación pendiente
            Resultado = 0.0 ' memoria del programa a cero
            Operador = "" ' operador pendiente  
        Else ' si la pantalla está vacía
            Resultado = 0.0 ' simplemente pongo Resultado a cero
            pantallaCursor() ' cursor colocado para escribir de nuevo
        End If
    End Sub

    ' Botón Puesta a cero
    Private Sub btAcero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btAcero.Click
        Resultado = 0.0  ' resultado parcial a cero
        txtPantalla.Text = "" ' pantalla a cero
        Operador = "" ' no dejamos operación pendiente
        pantallaCursor() ' cursor colocado para escribir de nuevo
    End Sub

    ' Botón de Apagado
    Private Sub btApagado_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btApagado.Click
        Close()
    End Sub

    ' Para guardar el número en memoria
    Private Sub btMS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btMS.Click
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            Memoria = txtPantalla.Text
        Else ' si la pantalla está vacía
            pantallaCursor() ' cursor colocado para escribir de nuevo
        End If
    End Sub

    ' Para recuperar el número de la memoria
    Private Sub btMR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btMR.Click
        If txtPantalla.Text.Length > 0 Then ' si hay dígitos en la pantalla
            txtPantalla.Text = Memoria
        ElseIf txtPantalla.Text.Length = 0 Then
            If Memoria > 0 Then txtPantalla.Text = Memoria
            If Memoria = 0 Then txtPantalla.Text = ""
        End If
        pantallaCursor() ' cursor colocado para escribir de nuevo
    End Sub

    ' Para vaciar la memoria
    Private Sub btMC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btMC.Click
        Memoria = 0.0
        pantallaCursor() ' cursor colocado para escribir de nuevo
        'End If
    End Sub

    ' Borrar los números de la pantalla
    Private Sub btC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btC.Click
        If Len(txtPantalla.Text) > 0 Then
            txtPantalla.Text = ""
        End If
        pantallaCursor() ' cursor colocado para escribir de nuevo
    End Sub

    ' Eventos de los botones de menú
    Private Sub menuSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuSalir.Click
        Close()
    End Sub

    Private Sub menuCodigo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuCodigo.Click
        pantallaCursor() ' cursor colocado para escribir de nuevo
        Dim codPrograma As New Form3   ' nueva variable de la clase formulario
        codPrograma.ShowDialog() ' abrir el formulario Form3
    End Sub

    Private Sub menuCalculadora_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuCalculadora.Click
        pantallaCursor() ' cursor colocado para escribir de nuevo
        Dim Calculadora As New Form2   ' nueva variable de la clase formulario
        Calculadora.ShowDialog() ' abrir el formulario Form2
    End Sub

End Class