locked
C# Creating a program in Microsoft Visual Studio 2012 RRS feed

  • Question

  • How do I create the logic for a program that accepts input values for the projected cost of a vacation and the number of months until vacation. Pass both values to a method that displays the amount you must save per month to achieve your goal.

    I'm totally like stuck on this, I need help please! I have downloaded the Microsoft Visual Studio 2012 to my desktop and was wondering how to get the code for that. Any help. I would really appreciate it!

    • Moved by Amanda Zhu Thursday, August 1, 2013 1:37 AM
    Wednesday, July 31, 2013 6:05 AM

Answers

  • First you must learn how to use Visual Studio. There are many elaborated tutorials online.

    Basically, you first have to select language you want to use and create a new project (i don't know if you want to make a window application or web application) but you can do that from the list.

    Learn how to create (drag and drop to your form) labels, textboxes and buttons and change their parameters if you need, like name etc.

    Important: learn how to create events. You can see little thunder flash sign (on a tab) of properties window. Events are the actions which triggers code. Like what to do when button is clicked.

    Learn how to fetch values from text boxes

    Eg: var a = textBox1.Text; will put the string value of the textbox named textBox1 to the variable a.

    Ask month and duration of months from two different textboxes on your form.

    Make a button that says Calculate or Evaluate. Make event of that button.

    Remember to validate the data that user inputted. Like if the amount may not contain any alphabets. Validation codes can be done under button click event (for your simplicity).

    After all values accord format. You can create a function/method on your code that take two input and returns a value (Learn how to write a method).

    Note that button click event itself is a method.

    After you divide (or sth. mathematical operation), display that value as you want. For your simplicity create a textbox that has label of Result and lets say is named "textBox3". The value to the text box can be passed as following.

    textBox3.Text = resultVarriable.ToString();

    If you don't know, learn simple coding/programming like how to create variables, method/functions and how to return data from a method and how to fetch it on C# which is very easy.

    • Marked as answer by Caillen Wednesday, August 7, 2013 4:29 AM
    Thursday, August 1, 2013 2:16 AM

All replies

  • Hello,

    I have moved this thread to Visual C# forum for better response.

    Best regards,


    Amanda Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 1, 2013 1:38 AM
  • First you must learn how to use Visual Studio. There are many elaborated tutorials online.

    Basically, you first have to select language you want to use and create a new project (i don't know if you want to make a window application or web application) but you can do that from the list.

    Learn how to create (drag and drop to your form) labels, textboxes and buttons and change their parameters if you need, like name etc.

    Important: learn how to create events. You can see little thunder flash sign (on a tab) of properties window. Events are the actions which triggers code. Like what to do when button is clicked.

    Learn how to fetch values from text boxes

    Eg: var a = textBox1.Text; will put the string value of the textbox named textBox1 to the variable a.

    Ask month and duration of months from two different textboxes on your form.

    Make a button that says Calculate or Evaluate. Make event of that button.

    Remember to validate the data that user inputted. Like if the amount may not contain any alphabets. Validation codes can be done under button click event (for your simplicity).

    After all values accord format. You can create a function/method on your code that take two input and returns a value (Learn how to write a method).

    Note that button click event itself is a method.

    After you divide (or sth. mathematical operation), display that value as you want. For your simplicity create a textbox that has label of Result and lets say is named "textBox3". The value to the text box can be passed as following.

    textBox3.Text = resultVarriable.ToString();

    If you don't know, learn simple coding/programming like how to create variables, method/functions and how to return data from a method and how to fetch it on C# which is very easy.

    • Marked as answer by Caillen Wednesday, August 7, 2013 4:29 AM
    Thursday, August 1, 2013 2:16 AM
  • I have moved this thread to Visual C# forum for better response.

    Maybe you should move it to a "Do my homework for me" forum.

    Paul Linton

    Thursday, August 1, 2013 2:16 AM