Presentation is loading. Please wait.

Presentation is loading. Please wait.

Addition Project CSIT 230 (Blum).

Similar presentations


Presentation on theme: "Addition Project CSIT 230 (Blum)."— Presentation transcript:

1 Addition Project CSIT 230 (Blum)

2 We designed a form as seen below with 2 Textboxes, 1 Button and 2 Labels
CSIT 230 (Blum)

3 The TextBoxes The TextBoxes names were set to txtNumber1 and txtNumber2. The Font Size was set to 28 pt. The height of a TextBox is determined by the Font Size. The TextAlign property was set to Right. We expect the user to enter numbers and the convention is that numbers are right justified. CSIT 230 (Blum)

4 The Button The Button’s Name was set to btnPlus.
The Font Size was set to 24 pt. The Text was set to “+”. CSIT 230 (Blum)

5 The First Label (the black line)
We allowed it to have the default name Label1 since it will not be involved in any way with the interaction with the user or the coding thereof. We set AutoSize to False so that we could control the size of the label rather than having it controlled by the text it contains. We set the BackColor to Black. CSIT 230 (Blum)

6 The Second Label (for the answer)
The Label’s name was set to lblSum. We set the AutoSize property to False. We set the BorderStyle to FixedSingle. We set the Font Size to 28 pt. We set the TextAlign property to MiddleRight. CSIT 230 (Blum)

7 First Attempt Our first attempt resulted in concatenation rather than addition. This makes some sense because what is expected to come from a TextBox is text and it makes sense to concatenate text. CSIT 230 (Blum)

8 Second Attempt The CInt() function converts the expression inside its parentheses to an integer (whole number). Now the + comes between two numbers and numerical addition is performed. CSIT 230 (Blum)

9 What happened when the user entered something that cannot be converted (cast) as a integer
An “unhandled exception” is a fancy term for error. We will learn how to handle this exception and communicate the problem to the user. CSIT 230 (Blum)


Download ppt "Addition Project CSIT 230 (Blum)."

Similar presentations


Ads by Google