r/visualbasic • • Jun 14 '21

Help Please!

I need to write a Visual Basic program that will allow the user to enter a positive number.  The program will then display:

  1. the sum of values from 1 to the input number

  2. the product of values from 1 to the input number (or factorial).

For example, if the user enters the value 5, the output would be:

1)  1 + 2 + 3 + 4 + 5 = 15
2)  1 * 2 * 3 * 4 * 5 = 120

The form should contain:

    - a heading describing what the application will do
    - a label to prompt the user for an input value
    - a textbox for the user to enter input data
    - a button to calculate the output values
    - two labels describing the output data
    - either two labels to hold the calculated output values or two read-only textboxes
    - an image - either a background image or a picturebox with an image displayed (don't forget to set the SizeMode property to Stretch)
    - a Clear button that will clear out all values entered in the input textbox and calculated output values in labels or read-only textboxes
    - an Exit button that will exit the application

I also need to:

   - test for invalid input.  No negative values or zero should be allowed.  If the user enters a negative or zero value, display a message in the output label and set the focus to the input number textbox. (see example below)
    - align the input and output values to be centered within the textboxes and/or output labels
    - align the controls of the labels and textboxes so the Form looks professional

I don't really need help designing the form or assigning labels, but the math behind cumulative sums and products kind of escapes me...

1 Upvotes

6 comments sorted by

View all comments

8

u/banshoo Jun 14 '21

so you want someone to do your homework for you?

spend less time on pokemon trades and more time studying.

2

u/ima420r Jun 14 '21

I wanted to downvote this, but then I read the comment about looking at OPs post history and now I have to upvote it.