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...

Recommended Answers

All 4 Replies

Where is your code?

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

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)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.