.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

Lesson 8 - Select Case Control Structure

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

In the previous lesson, we have learned how to control the program flow using the If...ElseIf control structure. In this chapter, you will learn  another way to control the program flow, that is, the Select Case control structure. However, the Select Case control structure is slightly different from the If....ElseIf control structure . The difference is that the Select Case control structure basically only make decision on one expression or dimension (for example the examination grade) while the If ...ElseIf statement control structure may evaluate only one expression, each If....ElseIf statement may also compute entirely different dimensions. Select Case is preferred when there exist many different conditions because using If...Then..ElseIf statements might become too messy.

The format of the Select Case control structure is show below:

    Select Case expression

       Case value1
            Block of one or more VB statements
       Case value2
            Block of one or more VB Statements
       Case value3
                .
            .
       Case Else
            Block of one or more VB Statements

    End Select

Example 8.1

    Dim grade As String

    Private Sub 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"

              Case Else
                    result.Caption="Fail"

          End Select

        End Sub

Example 8.3

Example 8.2 could be rewritten  as follows:

    Dim mark As Single
    Private Sub Compute_Click()


        'Examination Marks

         mark = mrk.Text
        
        Select Case mark

         Case 0 to 49
        
             comment.Caption = "Need to work harder"
        
        Case 50 to 59
        
            comment.Caption = "Average"
        
        Case 60 to 69

           comment.Caption = "Above Average"
        

        Case 70 to 84

        comment.Caption = "Good"        

        Case Else

        comment.Caption = "Excellence"

        End Select    

    End Sub

Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel Lesson 8 - Select Case Control Structure, Diterbitkan oleh scodeaplikasi pada Selasa, 31 Januari 2012. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to