Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome with Ifs CSC 230 (Blum).

Similar presentations


Presentation on theme: "Welcome with Ifs CSC 230 (Blum)."— Presentation transcript:

1 Welcome with Ifs CSC 230 (Blum)

2 Add a ComboBox and give it a name (e.g. cboLanguauge)
CSC 230 (Blum)

3 Click next to the Items property and then the ellipsis button that results.
CSC 230 (Blum)

4 Use the String Collection Editor dialog box to enter the language names.
CSC 230 (Blum)

5 Result so far CSC 230 (Blum)

6 Set the Text property to “English” (the ComboBox will now start with an entry)
CSC 230 (Blum)

7 Add a button (btnOK) and label (lblMessage)
CSC 230 (Blum)

8 btnOK_Click subroutine uses If to establish different behavior in different cases
CSC 230 (Blum)

9 Structure of an If If cboLanguage.Text = "English" Then
lblMessage.Text = "Welcome" End If If, Then and End are keywords the establish the structure of the If statement Between If and Then comes a condition – an expression that evaluates to True or False Between the line starting with If and the End If line comes a statement or set of statements to be executed provided the condition is true and is ignored should the condition be false CSC 230 (Blum)

10 Result User forgot to click OK button CSC 230 (Blum)

11 Return to Design view and double click on the ComboBox
The ComboBox has a SelectedIndexChanged event and we will put our code here and eliminate the button altogether CSC 230 (Blum)

12 New buttonless design CSC 230 (Blum)

13 New buttonless code CSC 230 (Blum)

14 Result: Somewhat improved with no button for user to forget to click
CSC 230 (Blum)


Download ppt "Welcome with Ifs CSC 230 (Blum)."

Similar presentations


Ads by Google