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:
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
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:
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.
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.
- 0useful
- 0not useful
#3. Posted:
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
- 0useful
- 0not useful
#4. Posted:
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.
- 0useful
- 0not useful
#5. Posted:
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.
- 0useful
- 0not useful
#6. Posted:
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?
- 0useful
- 0not useful
#7. Posted:
Status: Offline
Joined: Apr 23, 201410Year Member
Posts: 645
Reputation Power: 25
#8. Posted:
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.
- 0useful
- 0not useful
#9. Posted:
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.
- 0useful
- 0not useful
#10. Posted:
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?
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.