student
Publicado por DonGatoPR (3 intervenciones) el 21/11/2006 23:48:19
Tengo este codigo abajo mostrado, quiciera saber como puedo hacer para el en el textbox txtCurrentBudget me vaya sumando las cantidades entradas en el txtItemPrice y sea acomulada. Ejemplo
Budget $9
ItemPrice $3
CurrentBudget $6
y si le pongo otro ItemPrice seria
Budget $6
ItemPrice$6
CurrentBudget $0
Espero haberme podido explicar bien... si alguien me puede ayudar????????
Public Class Form1
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
Dim Budget As Integer
Budget = txtBudget.Text
Dim Result As Double
txtCurrentBudget.Text = txtBudget.Text - txtItemPrice.Text
Result = txtCurrentBudget.Text
txtCurrentBudget.Text += Format$(txtCurrentBudget.Text, "Currency")
If (Result = 0) Then
MessageBox.Show(" Ok, Good you complete your Budget!!, this is your last item, you can't buy anymore ")
ElseIf (Result < 0) Then
MessageBox.Show(" You exceede your Budget Limited by " & Format$(txtBudget.Text - txtItemPrice.Text, "Currency"))
ElseIf (Result >= 1) Then
MessageBox.Show(" You have " & Format$(Result, "Currency") & " left for more items ")
End If
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtBudget.Text = "0"
txtItemPrice.Text = "0"
txtCurrentBudget.Text = "0"
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
End Class
Budget $9
ItemPrice $3
CurrentBudget $6
y si le pongo otro ItemPrice seria
Budget $6
ItemPrice$6
CurrentBudget $0
Espero haberme podido explicar bien... si alguien me puede ayudar????????
Public Class Form1
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
Dim Budget As Integer
Budget = txtBudget.Text
Dim Result As Double
txtCurrentBudget.Text = txtBudget.Text - txtItemPrice.Text
Result = txtCurrentBudget.Text
txtCurrentBudget.Text += Format$(txtCurrentBudget.Text, "Currency")
If (Result = 0) Then
MessageBox.Show(" Ok, Good you complete your Budget!!, this is your last item, you can't buy anymore ")
ElseIf (Result < 0) Then
MessageBox.Show(" You exceede your Budget Limited by " & Format$(txtBudget.Text - txtItemPrice.Text, "Currency"))
ElseIf (Result >= 1) Then
MessageBox.Show(" You have " & Format$(Result, "Currency") & " left for more items ")
End If
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtBudget.Text = "0"
txtItemPrice.Text = "0"
txtCurrentBudget.Text = "0"
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
End Class
Valora esta pregunta


0