Selasa, 08 Maret 2011

Tugas Praktikum1 no.2






Syntax
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim tot, tot_pinjam, tot_tahun As Single
        tot_pinjam = CSng(TextBox1.Text)

        If ComboBox1.SelectedIndex = 0 Then
            tot_tahun = CSng(TextBox1.Text) * 0.05
        ElseIf ComboBox1.SelectedIndex = 1 Then
            tot_tahun = CSng(TextBox1.Text) * 0.1
        Else
            tot_tahun = CSng(TextBox1.Text) * 0.15
        End If

        TextBox2.Text = CStr(tot_tahun)

        If RadioButton1.Checked = True Then
            tot = tot_tahun * 5
        ElseIf RadioButton1.Checked = True Then
            tot = tot_tahun * 10
        Else
            tot = tot_tahun * 15
        End If

        TextBox3.Text = CStr(tot)

    End Sub

Selasa, 01 Maret 2011

Tugas Praktikum 1 TPT (VB.Net)

Tugas Praktikum 1 TPT  no. 1


Output :

 

Syntax
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Clear()
        TextBox2.Clear()
        TextBox3.Clear()
        RadioButton1.Checked = False
        RadioButton2.Checked = False
        RadioButton3.Checked = False
        RadioButton4.Checked = False

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim a, b As Integer
        a = CInt(TextBox1.Text)
        b = CInt(TextBox2.Text)
      
        If RadioButton1.Checked = True Then
            TextBox3.Text = CStr(a / b)
        ElseIf RadioButton2.Checked = True Then
            TextBox3.Text = CStr(a Mod b)
        ElseIf RadioButton3.Checked = True Then
            TextBox3.Text = CStr(a ^ b)
        ElseIf RadioButton4.Checked = True Then
            TextBox3.Text = CStr(a & b)
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Application.Exit()

    End Sub
End Class


nb : barangkali ada yang belum paham boleh tanya disini :)