Bom dia.
Agradeço ajuda num form com checkbox's a adicionar valores a uma label, como posso devolver a quantidade a retirar pretendida? Isto em VB 6.
Cumprimentos.
não compreendi lá muito bem o que queres.
Queres por labels com valores e ao clicares na check box a frente delas te some os valores e te de o resultado?
Private Sub Check1_Click()
Dim x, y, z, w As Integer
If Check1.Value = 1 Then
x = Val(InputBox("Quantidade:"))
z = Val(Label1) + (300 * x)
Label1 = z
ElseIf Check1.Value = 0 Then
y = Val(InputBox("Quantidade a retirar:"))
w = Val(Label1) + (z - 300)
Label1 = w
End If
End Sub
é exactamente isso, só n consigo é devolver o valor pretendido... parece-me q estou a retirar ao z os 300 sempre. Se carregar 2 quantidades e depois retirar outras 2, aparece uma quantidade de 300. Cumps
Ex:
Private Sub Check1_Click()
Dim x, y, z, w As Integer
If Check1.Value = 1 Then
x = Val(InputBox("Quantidade:"))
z = Val(Label1) + (300 * x)
Label1 = z
ElseIf Check1.Value = 0 Then
y = Val(InputBox("Quantidade a retirar:"))
w = Val(Label1) + (z - 300)
Label1 = w
End If
End Sub
Private Sub Check1_Click()
Dim x, y, z, w As Integer
If Check1.Value = 1 Then
If p = 0 Then
x = Val(InputBox("Quantidade:"))
z = Val(Label1) + (300 * x)
Label1 = z
p=p+1
Else
y = Val(InputBox("Quantidade a retirar:"))
w = Val(Label1) + (z - 300)
Label1 = w
p=p-1
End If
end if
End Sub
Private Sub Check1_Click()
Dim x As Integer
If Check1.Value = 1 Then
x = Val(InputBox("Quantidade:"))
Label1 = Val(Label1) + x
Else
x = Val(InputBox("Quantidade a retirar:"))
Label1 = Val(Label1) - x
End If
End Sub