• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Decision statements in vb.net
 

Decision statements in vb.net

on

  • 5,872 views

 

Statistics

Views

Total Views
5,872
Views on SlideShare
5,797
Embed Views
75

Actions

Likes
2
Downloads
93
Comments
0

2 Embeds 75

http://www.ustudy.in 69
http://ustudy.in 6

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Decision statements in vb.net Decision statements in vb.net Presentation Transcript

    • DECISION STATEMENTSINVB.NET
    • Introduction
      Decision making statements in VB.NET are used to control the flow of a program by checking one or more conditions. There are 3 types, They are
      If … then
      If …. Then … else
      Select case
    • If .. then
      This statement is used to test a condition and execute a set of statements if the condition is true . If it is false, the statement which is next to the if … then structure is executed.
    • syntax
      If Condition Then    One or more Visual Basic statementsEnd If
    • Example
      Dim mark as integer
      If mark>40 then
      Msgbox (“Pass”)
      End if
    • If … then … else
      This statement is used to test a condition and execute a set of statements if the condition is true and execute another set of statement if it is false.
    • Syntax
      If condition Then  One or more statementsElse  One or more statementsEndIf
    • Example
      Dim a AsIntegerDim b AsIntegera = 3b = 4If a > b Then    MsgBox("a is greater then b")Else    MsgBox("b is greater then a")EndIf
    • Select case statement
      The Select Case statement executes one of several groups of statements depending on the value of an expression. If your code has the capability to handle different values of a particular variable then you can use a Select Case statement. You use Select Case to test an expression, determine which of the given cases it matches and execute the code in that matched case.
    • Syntax
      Select Case expression    Case value1         Statement 1    Case value2         Statement 2   Case value3       Statement 3    Case value4         .         .         .    CaseElse        StatementEnd Select
    • Example
      ' Examination Grades Dim grade AsStringPrivateSub Compute_Click()    grade= txtgrade.Text    Select Case grade       Case  "A"           result.Caption="High Distinction"      Case"A-"          result.Caption="Distinction"      Case"B"            result.Caption="Credit"      Case"C"            result.Caption="Pass"      CaseElse            result.Caption="Fail"      End Select EndSub
    • The End.
      … Thank u…