DuroPt Posted May 30, 2008 at 02:14 PM Report Share #188569 Posted May 30, 2008 at 02:14 PM Olá sou novo novo novo =P Este é o meu problema, estava tentar fazer uma calculadora, e comecei por por este código: Private Sub Command1_Click(Index As Integer) Select Case Index Select Case 0 Label1.Caption = Label1.Caption & "0" Select Case 1 Label1.Caption = Label1.Caption & "1" Select Case 2 Label1.Caption = Label1.Caption & "2" Select Case 3 Label1.Caption = Label1.Caption & "3" Select Case 4 Label1.Caption = Label1.Caption & "4" Select Case 5 Label1.Caption = Label1.Caption & "5" Select Case 6 Label1.Caption = Label1.Caption & "6" Select Case 7 Label1.Caption = Label1.Caption & "7" Select Case 8 Label1.Caption = Label1.Caption & "8" Select Case 9 Label1.Caption = Label1.Caption & "9" End Select End Sub Quando meti play, só para ver se estava a funcionar, tudo bem, quando cliquei numa tecla, qualquer que seja, deu o seguinte erro: " Compile error: Statements and labels invalid between Select case and first case" Não entendo! Abraços! http://phoboz.wordpress.com Link to comment Share on other sites More sharing options...
asworm Posted May 30, 2008 at 02:54 PM Report Share #188588 Posted May 30, 2008 at 02:54 PM salect case index case 0 case1... etc. experimenta la agora... Got it? Link to comment Share on other sites More sharing options...
DuroPt Posted May 30, 2008 at 02:59 PM Author Report Share #188592 Posted May 30, 2008 at 02:59 PM continua a dar erro...mas calculo que tenhas escrito a palavara "select" mas escrita! (salect) http://phoboz.wordpress.com Link to comment Share on other sites More sharing options...
asworm Posted May 30, 2008 at 03:02 PM Report Share #188594 Posted May 30, 2008 at 03:02 PM exacto, enganeime eu passo o codigo Private Sub Command1_Click(Index As Integer) Select Case Index Case 0 Label1.Caption = Label1.Caption & "0" Case 1 Label1.Caption = Label1.Caption & "1" Case 2 Label1.Caption = Label1.Caption & "2" Case 3 Label1.Caption = Label1.Caption & "3" Case 4 Label1.Caption = Label1.Caption & "4" Case 5 Label1.Caption = Label1.Caption & "5" Case 6 Label1.Caption = Label1.Caption & "6" Case 7 Label1.Caption = Label1.Caption & "7" Case 8 Label1.Caption = Label1.Caption & "8" Case 9 Label1.Caption = Label1.Caption & "9" End Select End Sub ve la agora Got it? Link to comment Share on other sites More sharing options...
DuroPt Posted May 30, 2008 at 03:05 PM Author Report Share #188597 Posted May 30, 2008 at 03:05 PM LOOL e não é que está a dar! capaz de tu perceberes disto! ;D http://phoboz.wordpress.com Link to comment Share on other sites More sharing options...
DuroPt Posted May 30, 2008 at 03:06 PM Author Report Share #188598 Posted May 30, 2008 at 03:06 PM aha ok granda burro ...LOl ja percebi o que estava a fazer mal...oh meud eus XD ABRAÇOS http://phoboz.wordpress.com Link to comment Share on other sites More sharing options...
asworm Posted May 30, 2008 at 03:08 PM Report Share #188599 Posted May 30, 2008 at 03:08 PM muitas horas a programar... e inda não sei metade do que se pode fazer em basic... cumps sempre as ordens Got it? Link to comment Share on other sites More sharing options...
DuroPt Posted May 30, 2008 at 03:26 PM Author Report Share #188604 Posted May 30, 2008 at 03:26 PM Private Sub Command1_Click(Index As Integer) Dim K As Integer Select Case Index Case 0 Label1.Caption = Label1.Caption & "0" Case 1 Label1.Caption = Label1.Caption & "1" Case 2 Label1.Caption = Label1.Caption & "2" Case 3 Label1.Caption = Label1.Caption & "3" Case 4 Label1.Caption = Label1.Caption & "4" Case 5 Label1.Caption = Label1.Caption & "5" Case 6 Label1.Caption = Label1.Caption & "6" Case 7 Label1.Caption = Label1.Caption & "7" Case 8 Label1.Caption = Label1.Caption & "8" Case 9 Label1.Caption = Label1.Caption & "9" Case 10 'Este é o comando com o sinal +(mais) K = Label1.Caption 'Para dar um valor a K, para que mais tarde seja somado Label1.Caption = "" 'para limpar a label End Select End Sub Não consigo sair daqui, alguem já tem uma calculadora feita, para eu ver o código e tentar perceber http://phoboz.wordpress.com Link to comment Share on other sites More sharing options...
jpaulino Posted May 30, 2008 at 03:33 PM Report Share #188606 Posted May 30, 2008 at 03:33 PM Dim K As Integer tem de ficar de fora do sub se não vai sempre a zero (quando fazer click) Define como Private K As Integer Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now