Pt Freelancer Posted March 28, 2006 at 05:54 PM Report #19852 Posted March 28, 2006 at 05:54 PM O projecto ta a ser feito em vb 2005 express edition e é uma simples maquina de calcular Public Class Units Const MB_YESNO = 4 Const IDYES = 6 Const MB_ICONQUESTION = 32 Const IDNO = 7 Const IDOKONLY = 1 Const MB_OKONLY = 0 Const MB_EXCLATION = 48 Dim Message As String Dim Answer As Integer Dim Buttons As Integer Dim Title As String Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing Message = "Do you want to quit?" Buttons = MB_YESNO + MB_ICONQUESTION Title = "IC Calculator" Answer = MsgBox(Message, Buttons, Title) If Answer = IDYES Then End Else e.Cancel = True End If End Sub Private Sub execute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdexecute.Click 'Type of Data Dim Cons As Integer Dim Bomber As Integer Dim Fighter As Integer Dim Soldier As Integer Dim Tran As Integer Dim Agent As Integer Dim Wizard As Integer Dim Droid As Integer ' Declared as Cons = Val(txtCons.Text) Bomber = Val(txtBombers.Text) Fighter = Val(txtFighters.Text) Soldier = Val(txtSoldiers.Text) Tran = Val(txtTransports.Text) Agent = Val(txtAgents.Text) Wizard = Val(txtWizards.Text) Droid = Val(txtDroids.Text) If Cons > 100 And Cons > 0 Then Message = "Construction bonus must be between 100 and 0" Buttons = IDOKONLY + MB_EXCLATION Title = "IC Calculator" Answer = MsgBox(Message, Buttons, Title) Else 'Calculation 'Gold txtGold.Text = Format$(((400 / (1 + (Cons / 100))) * Bomber) _ + ((200 / (1 + (Cons / 100))) * Fighter) _ + ((100 / (1 + (Cons / 100))) * Soldier) _ + ((800 / (1 + (Cons / 100))) * Tran) _ + ((150 / (1 + (Cons / 100))) * Agent) _ + ((150 / (1 + (Cons / 100))) * Wizard) _ + ((50 / (1 + (Cons / 100))) * Droid), "############") End If o q eu queria fazer agora, era q desse tambem erro quando o utilizador escrevesse caracteres sem serem numeros nos campos como txtcons.Text e txtbombers.Text, e possivel? Edit: tive um problema e fiz um double post (so agora e q percebi q n se pode fazer tabs..) apaguei o outro, espero n ter causado nenhum problema
UnKnowN Posted March 28, 2006 at 06:14 PM Report #19858 Posted March 28, 2006 at 06:14 PM Tens de usar a tabela ASCII, faz 1 breve Pesquisa pelo Fórum e irás incontrar o que procuras 😄
vbmaster Posted March 28, 2006 at 06:37 PM Report #19864 Posted March 28, 2006 at 06:37 PM Este thread sinto-me obrigado a bloquear, pois no espaço de dois dias é a segunda vez que a dúvida é posta, ainda para mais tnedo já sido respondida anteriormente. Link para soluções: http://www.portugal-a-programar.pt/index.php?showtopic=1519 http://www.portugal-a-programar.pt/index.php?showtopic=1906
Recommended Posts