VERSION 5.00 Begin VB.Form frmConta Caption = "Conta" ClientHeight = 5715 ClientLeft = 60 ClientTop = 345 ClientWidth = 5745 LinkTopic = "Form1" ScaleHeight = 5715 ScaleWidth = 5745 StartUpPosition = 3 'Windows Default Begin VB.Frame frmOperacoes Caption = "Operações" Height = 3255 Left = 840 TabIndex = 3 Top = 1680 Width = 3375 Begin VB.CommandButton cmdExecutarOp Caption = "Executar Operação" Height = 495 Left = 600 TabIndex = 6 Top = 2280 Width = 1815 End Begin VB.TextBox txtValor Height = 375 Left = 480 TabIndex = 0 Top = 1440 Width = 2055 End Begin VB.OptionButton optOp Caption = "Levantar" CausesValidation= 0 'False Height = 375 Index = 1 Left = 360 TabIndex = 5 Top = 840 Width = 2295 End Begin VB.OptionButton optOp Caption = "Depositar" CausesValidation= 0 'False Height = 255 Index = 0 Left = 360 TabIndex = 4 Top = 480 Value = -1 'True Width = 2535 End End Begin VB.TextBox txtSaldo CausesValidation= 0 'False Enabled = 0 'False Height = 375 Left = 1440 TabIndex = 2 Top = 600 Width = 1575 End Begin VB.Label lblSaldoNegativo Alignment = 2 'Center Caption = "Saldo Negativo" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 3480 TabIndex = 7 Top = 720 Width = 2055 End Begin VB.Label lblSaldo Alignment = 1 'Right Justify Caption = "Saldo :" Height = 255 Left = 600 TabIndex = 1 Top = 600 Width = 615 End End Attribute VB_Name = "frmConta" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Enum Operacoes opDepositar = 0 opLevantar End Enum Dim opSeleccionada As Integer Private WithEvents Conta As cConta Attribute Conta.VB_VarHelpID = -1 Private Sub cmdExecutarOp_Click() Select Case opSeleccionada Case opDepositar Conta.Depositar txtValor.Text Case opLevantar Conta.Levantar txtValor.Text End Select txtSaldo.Text = FormatCurrency(Conta.Saldo) txtValor.Text = "" txtValor.SetFocus End Sub Private Sub Conta_SaldoNegativo() lblSaldoNegativo.Visible = True End Sub Private Sub Conta_SaldoPositivo() lblSaldoNegativo.Visible = False End Sub Private Sub Form_Load() Set Conta = New cConta txtSaldo.Text = FormatCurrency(Conta.Saldo) optOp(0).Value = True opSeleccionada = opDepositar lblSaldoNegativo.Visible = False End Sub Private Sub optOp_Click(Index As Integer) opSeleccionada = Index txtValor.SetFocus End Sub Private Sub txtValor_Validate(Cancel As Boolean) If Not IsNumeric(txtValor.Text) Then MsgBox "Introduza um número ! " Cancel = True End If End Sub