Buscar

Funcion multiplicacion

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

VERSION 5.00
Begin VB.Form frmMultiplicacion 
 Caption = "Form1"
 ClientHeight = 2295
 ClientLeft = 60
 ClientTop = 435
 ClientWidth = 5055
 LinkTopic = "Form1"
 Picture = "frmMultiplicacion.frx":0000
 ScaleHeight = 2295
 ScaleWidth = 5055
 StartUpPosition = 3 'Windows Default
 Begin VB.TextBox txtNum1 
 Height = 405
 Left = 120
 TabIndex = 0
 Top = 720
 Width = 1215
 End
 Begin VB.TextBox txtNum2 
 Height = 375
 Left = 1800
 TabIndex = 1
 Top = 720
 Width = 1215
 End
 Begin VB.TextBox txtNum3 
 Height = 375
 Left = 3480
 TabIndex = 2
 Top = 720
 Width = 1215
 End
 Begin VB.TextBox txtRes 
 Height = 375
 Left = 2040
 Locked = -1 'True
 TabIndex = 3
 Top = 1320
 Width = 1575
 End
 Begin VB.CommandButton cmdSalir 
 Caption = "&Salir"
 BeginProperty Font 
 Name = "Script MT Bold"
 Size = 12
 Charset = 0
 Weight = 700
 Underline = 0 'False
 Italic = 0 'False
 Strikethrough = 0 'False
 EndProperty
 Height = 375
 Left = 3840
 TabIndex = 5
 Top = 1800
 Width = 1095
 End
 Begin VB.Label lblRes 
 BackStyle = 0 'Transparent
 Caption = "Resultado"
 BeginProperty Font 
 Name = "Script MT Bold"
 Size = 14.25
 Charset = 0
 Weight = 700
 Underline = 0 'False
 Italic = 0 'False
 Strikethrough = 0 'False
 EndProperty
 ForeColor = &H0000FFFF&
 Height = 375
 Left = 600
 TabIndex = 8
 Top = 1320
 Width = 1335
 End
 Begin VB.Label lblX 
 AutoSize = -1 'True
 BackStyle = 0 'Transparent
 Caption = "X"
 BeginProperty Font 
 Name = "Papyrus"
 Size = 12
 Charset = 0
 Weight = 700
 Underline = 0 'False
 Italic = -1 'True
 Strikethrough = 0 'False
 EndProperty
 ForeColor = &H0000FFFF&
 Height = 375
 Index = 0
 Left = 1440
 TabIndex = 7
 Top = 720
 Width = 195
 End
 Begin VB.Label lblX 
 AutoSize = -1 'True
 BackStyle = 0 'Transparent
 Caption = "X"
 BeginProperty Font 
 Name = "Papyrus"
 Size = 12
 Charset = 0
 Weight = 700
 Underline = 0 'False
 Italic = -1 'True
 Strikethrough = 0 'False
 EndProperty
 ForeColor = &H0000FFFF&
 Height = 375
 Index = 1
 Left = 3120
 TabIndex = 6
 Top = 720
 Width = 195
 End
 Begin VB.Label lblIndicacion 
 AutoSize = -1 'True
 BackStyle = 0 'Transparent
 Caption = "Escribe los numeros a multiplicar"
 BeginProperty Font 
 Name = "Script MT Bold"
 Size = 12
 Charset = 0
 Weight = 700
 Underline = 0 'False
 Italic = -1 'True
 Strikethrough = 0 'False
 EndProperty
 ForeColor = &H0000FFFF&
 Height = 285
 Left = 120
 TabIndex = 4
 Top = 240
 Width = 3135
 End
End
Attribute VB_Name = "frmMultiplicacion"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
 Dim num1 As Integer
 Dim num2 As Integer
 Dim num3 As Integer
Function Multiplicacion() As Double
 If txtNum1 = "" Then
 num1 = 1
 Else
 num1 = Val(txtNum1)
 End If
 If txtNum2 = "" Then
 num2 = 1
 Else
 num2 = Val(txtNum2)
 End If
 If txtNum3 = "" Then
 num3 = 1
 Else
 num3 = Val(txtNum3)
 End If
 Multiplicacion = num1 * num2 * num3
End Function
Private Sub cmdSalir_Click()
 Unload Me
End Sub
Private Sub txtNum1_Change()
 txtRes = Multiplicacion()
End Sub
Private Sub txtNum2_Change()
 txtRes = Multiplicacion()
End Sub
Private Sub txtNum3_Change()
 txtRes = Multiplicacion()
End Sub
Private Sub txtNum1_Keypress(KeyAscii As Integer)
 If Not IsNumeric(Chr$(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0
 If KeyAscii = 8 Then
 txtNum1 = ""
 End If
End Sub
Private Sub txtNum2_Keypress(KeyAscii As Integer)
 If Not IsNumeric(Chr$(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0
 If KeyAscii = 8 Then
 txtNum2 = ""
 End If
End Sub
Private Sub txtNum3_Keypress(KeyAscii As Integer)
 If Not IsNumeric(Chr$(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0
 If KeyAscii = 8 Then
 txtNum3 = ""
 End If
End Sub

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Outros materiais