Saturday, April 19, 2014

if then else
==============>

 Dim nilai As Integer
        nilai = Val(TextBox1.Text)
        If (nilai >= 65 And nilai <= 100) Then                                                                        
            Label3.Text = "LULUS"
        ElseIf (nilai > 100) Then
            Label3.Text = "ANGKA YANG ANDA MASUKAN SALAH"
        Else
            Label3.Text = "GAGAL"
        End If
    End Sub


funsi len
=========>
button len
==============
    TextBox1.Text = Len(TextBox1.Text)
button proses
===============
  Dim teks1, teks2 As String
        teks1 = "Endra"
        teks2 = "Saputra"
        TextBox1.Text = teks1 + " " + teks2
    End Sub

kondisional
============>
button proses
=============
  Select Case coperator.Text
            Case "<>"
                vhasil1.Text = Val(vnilai12.Text) <> Val(vnilai22.Text)
            Case "<"
                vhasil1.Text = Val(vnilai12.Text) < Val(vnilai22.Text)
            Case ">"
                vhasil1.Text = Val(vnilai12.Text) > Val(vnilai22.Text)
            Case "<="
                vhasil1.Text = Val(vnilai12.Text) <= Val(vnilai22.Text)
            Case ">="
                vhasil1.Text = Val(vnilai12.Text) >= Val(vnilai22.Text)
          
        End Select
di dalam form
===============
   coperator.Items.Add("<>")
        coperator.Items.Add("<")
        coperator.Items.Add(">")
        coperator.Items.Add("<=")
        coperator.Items.Add(">=")
    End Sub

logika
=========>
button proses
==============
    Select cmdoperator.Text
            Case "="
                vhasil.Text = Not vnilai1.Text = vnilai2.Text
            Case "and"
                vhasil.Text = vnilai1.Text = "STMIK INDONESIA" And vnilai2.Text = "STMIK"
            Case "or"
                vhasil.Text = vnilai1.Text = "STMIK INDONESIA" Or vnilai2.Text = "STMIK"
            Case "xor"
                vhasil.Text = vnilai1.Text = "STMIK INDONESIA" Xor vnilai2.Text = "STMIK"
        End Select

    End Sub
didalam form
=============
cmdoperator.Items.Add("not")
        cmdoperator.Items.Add("and")
        cmdoperator.Items.Add("or")
        cmdoperator.Items.Add("xor")

manipulasi string
===================>
 Dim teks1, teks2 As String
        teks1 = "Endra"
        teks2 = "Saputra"
        TextBox1.Text = teks1 + " " + teks2
    End Sub

struktur if
============>
  Dim nilai As Integer
        nilai = Val(TextBox1.Text)
        If (nilai >= 0 And nilai <= 50) Then
            Label3.Text = "FAIL"
        ElseIf (nilai >= 51 And nilai <= 65) Then
            Label3.Text = "GOOD"
        ElseIf (nilai >= 66 And nilai <= 85) Then
            Label3.Text = "VERRY GOOD"
        ElseIf (nilai >= 86 And nilai <= 100) Then
            Label3.Text = "EXCELENT"
        Else
            Label3.Text = "MAAF, NILAI DILUAR RANGE..."

        End If


    End Sub

tour
=====>
button proses
=============
  Dim Teks As Integer
        Teks = Val(TextBox2.Text)
        Select Case (Teks)
            Case Is >= 15
                TextBox3.Text = "pergi tour"
            Case Else
                TextBox3.Text = "home"

                ' TextBox3.Text = TextBox2.Text = "boleh" Or TextBox2.Text = "tidak boleh"
                ' Case "<"
                '    TextBox3.Text = (TextBox2.Text) < 15 = "tidak boleh"
                'Case ">"
                '   TextBox3.Text = (TextBox2.Text) > 15 = "boleh"


        End Select


    End Sub
button len
===========
 TextBox2.Text = Len(TextBox1.Text)

convers berat
=============>
 Dim gram, kg As Single
        gram = vgram.Text
        kg = gram / 1000
        vkg.Text = kg
    End Sub

cekbox dan radio button
=======================>
cekbox
==========
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        Label1.Font = New Font("Microsoft Sans Serif", Label1.Font.Size, Label1.Font.Style Xor FontStyle.Strikeout)

    End Sub

    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        Label1.Font = New Font("Microsoft Sans Serif", Label1.Font.Size, Label1.Font.Style Xor FontStyle.Underline)
    End Sub

radio button
============
   Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        Label1.Font = New Font("Microsoft Sans Serif", Label1.Font.Size, Label1.Font.Style Xor FontStyle.Bold)
    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        Label1.Font = New Font("Microsoft Sans Serif", Label1.Font.Size, Label1.Font.Style Xor FontStyle.Regular)
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        Label1.Font = New Font("Microsoft Sans Serif", Label1.Font.Size, Label1.Font.Style Xor FontStyle.Italic)
    End Sub

    Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
        Label1.Font = New Font("Microsoft Sans Serif", Label1.Font.Size, Label1.Font.Style Xor FontStyle.Bold Xor FontStyle.Italic)

    End Sub