You are viewing our Forum Archives. To view or take place in current topics click here.
Need help with my code in Visual Express 2012 I will rep
Posted:

Need help with my code in Visual Express 2012 I will repPosted:

ICR7I
  • Prospect
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
So basically I am creating a shop windows form whenever I select an item it shows the price which works fine. But then I have a Textbox for the quantity and one for the total so for example when the user increases the quantity my total price should increase . The problem is it does it once but then doesn't update it which is the big problem.
There is my code for it I have tried it in If statements etc still no luck. Help would be appreciated.
CostOfAllItems.Text = QuantityBox.Text * CostOfItem.Text
#2. Posted:
murded1
  • Resident Elite
Status: Offline
Joined: Jan 06, 201014Year Member
Posts: 237
Reputation Power: 9
Status: Offline
Joined: Jan 06, 201014Year Member
Posts: 237
Reputation Power: 9
What do you mean it doesn't update it?

Can you run me through the process?
1. User Selects item
2. Picks Quantity

The price should update if the quantity changes correct? if this is the case then you need to put the code in the place that is run when the value changes.
#3. Posted:
ICR7I
  • Prospect
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Yes that is correct that is what I need to do but I don't know the correct place to place the code. I repped you
#4. Posted:
murded1
  • Resident Elite
Status: Offline
Joined: Jan 06, 201014Year Member
Posts: 237
Reputation Power: 9
Status: Offline
Joined: Jan 06, 201014Year Member
Posts: 237
Reputation Power: 9
I've never personally used visual express and I could be completely wrong but in something like Visual Studio for example you can select the field that you are applying the code to and you are then able to select different events such as textchanged ect.
#5. Posted:
ICR7I
  • Prospect
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Yes all my textboxes are textchanged and it still won't update. I have done previous exercises like this but they were all through buttons so the button always triggered the event but nothing is there to trigger the event this time.
#6. Posted:
Skittle
  • Video King
Status: Offline
Joined: Aug 20, 201410Year Member
Posts: 6,813
Reputation Power: 413
Status: Offline
Joined: Aug 20, 201410Year Member
Posts: 6,813
Reputation Power: 413
Can you show the code for the event handler in which you want the code to execute?
#7. Posted:
ICR7I
  • Prospect
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Here is my code for it. I tried the calculation in multiple event handlers but I had no luck. this was the only place that would even execute the code.

[ Register or Signin to view external links. ]

[ Register or Signin to view external links. ]
#8. Posted:
Skittle
  • Video King
Status: Offline
Joined: Aug 20, 201410Year Member
Posts: 6,813
Reputation Power: 413
Status: Offline
Joined: Aug 20, 201410Year Member
Posts: 6,813
Reputation Power: 413
If I am understanding your issue, you would need to put the code in a procedure that handles the TextChanged event of the QuantityBox and CostOfItem TextBoxes. That way the CostOfAllItems TextBox would update whenever you change the quantity of cost of item.
#9. Posted:
ICR7I
  • Prospect
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
In my combo box when I choose a different item it also works again it just won't automatically do it when you type a quantity in.
#10. Posted:
ICR7I
  • Prospect
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
-Skittle wrote If I am understanding your issue, you would need to put the code in a procedure that handles the TextChanged event of the QuantityBox and CostOfItem TextBoxes. That way the CostOfAllItems TextBox would update whenever you change the quantity of cost of item.


What sort of code would I need to put in?
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.