

Fitxer: m1p3.frm
Definició dels objectes. Interfície d'usuari
Recordeu que això no ho podeu editar directament. Per fer-ho incorporeu nous objectes
de la paleta en el vostre formulari. I per canviar els valors seleccioneu l'objecte i
escolliu la propietat a canviar en la finestra Properties.
VERSION 5.00
Begin VB.Form frmSumar
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Sumar"
ClientHeight = 3450
ClientLeft = 1815
ClientTop = 1515
ClientWidth = 7050
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 3450
ScaleWidth = 7050
Begin VB.CommandButton cmdTancar
Appearance = 0 'Flat
Caption = "&Tancar"
Height = 375
Left = 5760
TabIndex = 8
Top = 2760
Width = 975
End
Begin VB.CommandButton cmdEsborrar
Appearance = 0 'Flat
Caption = "&Esborrar"
Height = 375
Left = 5760
TabIndex = 7
Top = 2280
Width = 975
End
Begin VB.CommandButton cmdSumar
Appearance = 0 'Flat
Caption = "&Sumar"
Height = 1935
Left = 5760
TabIndex = 6
Top = 240
Width = 975
End
Begin VB.TextBox txtSuma
Appearance = 0 'Flat
Enabled = 0 'False
Height = 375
Left = 3600
TabIndex = 5
Top = 1800
Width = 1935
End
Begin VB.TextBox txtNúmero2
Appearance = 0 'Flat
Height = 375
Left = 3600
TabIndex = 3
Top = 840
Width = 1935
End
Begin VB.TextBox txtNúmero1
Appearance = 0 'Flat
Height = 375
Left = 3600
TabIndex = 2
Top = 240
Width = 1935
End
Begin VB.Label lblSumar
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "SUMA:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 375
Left = 1920
TabIndex = 4
Top = 1800
Width = 1575
End
Begin VB.Line Line1
X1 = 3600
X2 = 5520
Y1 = 1680
Y2 = 1680
End
Begin VB.Label lblIntrodueixNúmero2
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Introdueix un altre número:"
ForeColor = &H80000008&
Height = 375
Left = 240
TabIndex = 1
Top = 960
Width = 3255
End
Begin VB.Label lblIntrodueixNúmero1
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Introdueix un número:"
ForeColor = &H80000008&
Height = 375
Left = 240
TabIndex = 0
Top = 360
Width = 3135
End
End
Codi del programa. Programació de respostes a events
Attribute VB_Name = "frmSumar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdEsborrar_Click()
txtNúmero1.Text = ""
txtNúmero2.Text = ""
txtSuma.Text = ""
End Sub
Private Sub cmdSumar_Click()
Dim n1 As Single
Dim n2 As Single
Dim Suma As Single
n1 = Val(txtNúmero1.Text)
n2 = Val(txtNúmero2.Text)
Suma = n1 + n2
txtSuma.Text = Str$(Suma)
End Sub
Private Sub cmdTancar_Click()
End
End Sub