0

Hi all! i have a problem from my program in vb when i click the delete button....

EXAMPLE :

|QTY| NAME |PRICE
2 1st FOOD 250
1 2nd FOOD 150

TOTAL AMOUNT IN TEXTBOX >>>>> 400

DELETE BUTTON<<<<<<<<<

then when i click 1st food and click delete button

THIS IS THE OUPUT :

|QTY| NAME |PRICE
1 2nd FOOD 150

TOTAL AMOUNT IN TEXTBOX >>>>> 400

the 1st FOOD delete but the TOTAL AMOUNT IN TEXTBOX did not change ... still 400...not 150.... how to code that?? can some one help me.. ?? my program is just like a restaurant...

Edited by pritaeas: Changed title, please do NOT use all capitals.

5
Contributors
4
Replies
26
Views
4 Years
Discussion Span
Last Post by xcrunner15
0

simple...

on delete event

You have to get the price 150( or price of anythin) and store it in a variable

then add like the following line

int food_rem =Convert.ToInt32(txtfoodprice1.Text);
txttotal.Text= txttotal.Text-food_rem;

Hope this helps you my friend.

Have a happy coding...:-D

0

That is incorrect. You have to convert txtTotal.Text to a number before doing the calculation. There is also no reason to create a temp variable for one calculation.

txtTotal.Text = Convert.ToInt32(txtTotal.Text) - Convert.ToInt32(txtfoodprice1.Text)

Edited by Reverend Jim

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.