1 / 14

Welcome with Ifs

Welcome with Ifs. Add a ComboBox and give it a name (e.g. cboLanguauge). Click next to the Items property and then the ellipsis button that results. Use the String Collection Editor dialog box to enter the language names. Result so far.

starla
Download Presentation

Welcome with Ifs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome with Ifs

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

  3. Click next to the Items property and then the ellipsis button that results.

  4. Use the String Collection Editor dialog box to enter the language names.

  5. Result so far

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

  7. Add a button (btnOK) and label (lblMessage)

  8. btnOK_Click subroutine uses If to establish different behavior in different cases

  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

  10. Result User forgot to click OK button

  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

  12. New buttonless design

  13. New buttonless code

  14. Result: Somewhat improved with no button for user to forget to click

More Related