《Click_to_edit_Master_title___Cengage_Learning___Learning》由会员分享,可在线阅读,更多相关《Click_to_edit_Master_title___Cengage_Learning___Learning(64页珍藏版)》请在金锄头文库上搜索。
1、1 2 MicrosoftVisualBasic NET Reloaded Objectives IncludetheselectionstructureinpseudocodeandinaflowchartWriteanIf Then ElsestatementWritecodethatusescomparisonoperatorsandlogicaloperatorsCreateavariablehavingblockscopeUsethelinecontinuationcharacter 3 MicrosoftVisualBasic NET Reloaded Objectives con
2、tinued ConcatenatestringsUsetheControlCharsNewLineconstantChangethecaseofastringDeterminewhetheranexpressioncanbeconvertedtoanumberDisplayamessageinamessagebox 4 MicrosoftVisualBasic NET Reloaded Objectives continued Includeanestedselectionstructureinpseudocode flowchart andcodeCodeanIf Elseif Elses
3、electionstructureIncludeaCaseselectionstructureinpseudocode flowchartandcode 5 MicrosoftVisualBasic NET Reloaded TheSelectionStructure AlsocalleddecisionstructureMakeacomparisonandchoosebetween2pathsdependingupontheresultofcomparison condition 6 MicrosoftVisualBasic NET Reloaded WritingPseudocodefor
4、theIfandIf ElseSelectionStructures Ifselectionstructure 1setofinstructionswhichareprocessedifconditionistrueIf Else 2setsofinstructions thefirstwhenconditionistrue theotherwhenconditionisfalse 7 MicrosoftVisualBasic NET Reloaded FlowchartingtheIfandIf ElseSelectionStructures 8 MicrosoftVisualBasic N
5、ET Reloaded CodingtheIfandIf ElseSelectionStructures 9 MicrosoftVisualBasic NET Reloaded CodingtheIfandIf ElseSelectionStructures continued StatementBlockSetofinstructionsin true path betweenkeywordsIfandThen Optionalsetofinstructionsin false path betweenkeywordsThenandEndIf Anyitemsinsquarebrackets
6、areoptional 10 MicrosoftVisualBasic NET Reloaded ComparisonOperators Alsoreferredtoasrelationaloperators 11 MicrosoftVisualBasic NET Reloaded ComparisonOperators continued 12 MicrosoftVisualBasic NET Reloaded UsingComparisonOperators Example1 13 MicrosoftVisualBasic NET Reloaded UsingComparisonOpera
7、tors Example1 continued Note variableintTemphasblockscopeandcanonlybeusedinblockinwhichdeclared 14 MicrosoftVisualBasic NET Reloaded UsingComparisonOperators Example1 continued 15 MicrosoftVisualBasic NET Reloaded UsingComparisonOperators Example1 continued LinecontinuationcharacterSpacefollowedbyan
8、underscoreUsedtobreakuplonginstructionsonto2linesConcatenationOperatorTheampersand Usedtoconcatenate connectorlink strings 16 MicrosoftVisualBasic NET Reloaded UsingComparisonOperators Example1 continued 17 MicrosoftVisualBasic NET Reloaded HOWTO 18 MicrosoftVisualBasic NET Reloaded UsingComparisonO
9、perators Example2 19 MicrosoftVisualBasic NET Reloaded UsingComparisonOperators Example2 continued 20 MicrosoftVisualBasic NET Reloaded UsingComparisonOperators Example2 continued 21 MicrosoftVisualBasic NET Reloaded UsingtheToUpperandToLowerMethods 22 MicrosoftVisualBasic NET Reloaded UsingtheToUpp
10、erandToLowerMethods continued 23 MicrosoftVisualBasic NET Reloaded UsingtheToUpperandToLowerMethods continued 24 MicrosoftVisualBasic NET Reloaded LogicalOperators 25 MicrosoftVisualBasic NET Reloaded LogicalOperators continued 26 MicrosoftVisualBasic NET Reloaded TruthTables 27 MicrosoftVisualBasic
11、 NET Reloaded TruthTables continued Note short circuitevaluationcanoccurwith And operator Bothconditionswillnotbetestediffirstconditiontestsfalse 28 MicrosoftVisualBasic NET Reloaded UsingtheTruthTables Understandingorderofprecedenceiscritical 29 MicrosoftVisualBasic NET Reloaded UsingtheTruthTables
12、 continued 30 MicrosoftVisualBasic NET Reloaded UsingLogicalOperatorsinanIf Then ElseStatement 31 MicrosoftVisualBasic NET Reloaded ModifyingtheSkate AwaySalesApplication 32 MicrosoftVisualBasic NET Reloaded ModifyingtheSkate AwaySalesApplication continued Modifytoeliminateunwantederrormessage 33 Mi
13、crosoftVisualBasic NET Reloaded ModifyingtheSkate AwaySalesApplication continued 34 MicrosoftVisualBasic NET Reloaded TheIsNumericFunction Function ApredefinedprocedurethatperformsaspecifictaskandreturnsavalueaftercompletingthetaskIsNumericfunctionchecksifanexpressioncanbeconvertedtoanumberReturnsBo
14、oleantrueifabletoconverttonumberReturnsBooleanfalseifconversioncantbemade 35 MicrosoftVisualBasic NET Reloaded TheIsNumericFunction continued 36 MicrosoftVisualBasic NET Reloaded TheMessageBox Showmethod 37 MicrosoftVisualBasic NET Reloaded TheMessageBox Showmethod continued ArgumentsintheMessageBox
15、 ShowmethodText astringcontainingthetexttodisplayCaption textdisplayedintitlebarButtons buttonstodisplayinmessageboxCanbeoneof6differentconstantsIcon icondisplayedintitlebarDefaultbutton buttonautomaticallyselectedifuserpressestheEnterkeyonkeyboard 38 MicrosoftVisualBasic NET Reloaded TheMessageBox
16、Showmethod continued 39 MicrosoftVisualBasic NET Reloaded TheMessageBox Showmethod continued 40 MicrosoftVisualBasic NET Reloaded HOWTO 41 MicrosoftVisualBasic NET Reloaded NestedSelectionStructures Whenatleastonesideoftheselectionstructure spathcontainsanotherselectionstructureInnerstructureisreferredtoas nested Else ispairedupwithnearestprecedingIfregardlessofindentationofcodeUsewhenyouwanttomakeonedecisionandthenchoosebetweentwooptionsdependingupontheresultofthefirstdecision 42 MicrosoftVisua