How to make these functions in a calculator program? RRS feed

  • Question

  • Lets say you want to make an app that computes the cost per amount of something, and you wanted it to be 

    A) convertable to different units (aside from the calculations etc... I have that part down...) what I mean is how would you give the user 3 or 4 text box input choices but the unfilled ones wouldnt be used .... for instance

    a user needs to calculate for a craft project what the total cost is for the item produced.

    the max inputs would be 6; since usually for the item no more than 6 ingredients are used, but not always 6 ingredients are used....

    therefore you may have 2 text box's with inputted values and 4 that are blank or unused.

    would you just somehow set the input of those boxes to 0 or empty or something else if no input was detected? then if an input was detected the info would be available for use as a variable for equations.

    B) lets say you wanted to give them unit measurement options (grams or ounces) where depending on which radio button they chose, the labels and units for the conversion would change to the selected unit.

    Im trying to just mess around with a few small programs so i can get the hang of this stuff and I thought this would be a fun thing to do to develop more understanding.

    Thanks for any inpu
    • Moved by Amanda Zhu Monday, October 21, 2013 7:17 AM Not VS General issue
    Monday, October 14, 2013 5:14 AM


All replies

  • Hello,

    Thank you for your post.

    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System and Visual Studio Editor.

    I suggest that you try to consult you issue on Visual Studio Language forum: http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages based on your development language or Windows Forms General forum: http://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winforms and WPF forum: http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf based on your type of app.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Friday, October 25, 2013 7:18 PM
    • Marked as answer by Just Karl Sunday, November 3, 2013 12:37 AM
    Tuesday, October 15, 2013 3:17 AM
  • Normally an action on the from will start when a user presses a button.  In the button function you can read and/or write any control on the form.  So you can ignore any text box that is empty (use an if statement) allowiung you to have any number of your text boxes filled or not filled.  You can also create an event handler (or any of the controls on the form) like the radio buttons so when the user modifies the control (select one of the control buttons) the event handler can make a label (or any other object) change from grams to ounces.


    Tuesday, October 15, 2013 5:36 AM