Welcome to
Website...
***Fricles A Sianturi***
Thanks for
visiting...!!!

zwani.com myspace graphic comments
Myspace Christian Graphics

PANTUN HANGOLUAN TOIS HAMAGOAN

DAFTAR BLOG DOSEN DI STMIK BUDIDARMA MEDAN


Ingatlah selalu Akan Nama YESUS

SURGA DI TELAPAK KAKI IBU,KARENA ITU HORMATILAH KEDUA ORANG TUAMU

Kamis, 26 Januari 2012

Prorgam KALKULATOR SEDERHANA

calc 'sora'
cal 'sora'
Public Class Form1
Dim b1, b2, h As Double
Private Sub btntambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntambah.Click
b1 = Val(TextBox1.Text) ‘untuk mengidentifikasikan angka yang dimasukkan pada textbox1
b2 = Val(TextBox2.Text) ‘untuk mengidentifikasikan angka yang dimasukkan pada textbox2
h = b1 + b2 ‘perhitungan antara variabel yang telah dideklarasikan
TextBox3.Text = Str(h) ‘hasil perhitungan yang akan ditampilkan pada textbox3
End Sub
Private Sub btnbagi_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnbagi.Click
b1 = Val(TextBox1.Text)
b2 = Val(TextBox2.Text)
h = b1 / b2
TextBox3.Text = Str(h)
End Sub
Private Sub btnhapus_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnhapus.Click
Me.TextBox1.Clear()
Me.TextBox2.Clear()
Me.TextBox3.Clear()
Me.TextBox1.Focus()
End Sub
Private Sub btnkali_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnkali.Click
b1 = Val(TextBox1.Text)
b2 = Val(TextBox2.Text)
h = b1 * b2
TextBox3.Text = h
End Sub

BELAJAR CLASS
  1. BUAT FORM
  2. buat class ORANG_TUA
  3. buat class ANAK_WANITA
  4. buat class ANAK_PRIA
  5. CODING
Langkah2:
  1. Buat project baru “belajar class”
  2. buat form nya 1 listbox, 1 button
  3. buat class ORANG_TUA, ANAK_WANITA, ANAK_PRIA
  4. klik 2 x di button
  5. masukan kode :

   Public Class Form1
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Obj_W As New ANAK_WANITA
        Dim Obj_P As New ANAK_PRIA
         With Obj_W
            .Nama_Bapak = “Tri”
            .Nama_Ibu = “aijhai”
            .Nama_Wanita = “aiueo”
            .Usia_Wanita = “20″
        End With
        With Obj_P
            .Nama_Pria = “yudis”
            .Usia_Pria = “53″
        End With
        With ListBox1
            .Items.Add(“Nama Ayah: ” & Obj_W.Nama_Bapak)
            .Items.Add(“Nama Ibu: ” & Obj_W.Nama_Ibu)
            .Items.Add(“Nama Wanita :” & Obj_W.Nama_Wanita)
            .Items.Add(“Usia Wanita :” & Obj_W.Usia_Wanita)
            .Items.Add(“Nama Pria :” & Obj_P.Nama_Pria)
            .Items.Add(“Usia Pria :” & Obj_P.Usia_Pria)
        End With
    End Sub
End Class
 SCRIPT CLASS
Public Class ORANG_TUA
    Private XBapak As String
    Private XIbu As String
    Public Property Nama_Bapak() As String
        Get
            Return XBapak
        End Get
        Set(ByVal value As String)
            XBapak = value
        End Set
    End Property
    Public Property Nama_Ibu() As String
        Get
            Return XIbu
        End Get
        Set(ByVal value As String)
            XIbu = value
        End Set
    End Property
End Class
Public Class ANAK_WANITA
    Inherits ORANG_TUA
    Private XWanita As String
    Private XUsia_W As Byte
    Public Property Nama_Wanita() As String
        Get
            Return XWanita
        End Get
        Set(ByVal value As String)
            XWanita = value
        End Set
    End Property
    Public Property Usia_Wanita() As Byte
        Get
            Return XUsia_W
        End Get
        Set(ByVal value As Byte)
            XUsia_W = value
        End Set
    End Property
End Class
Public Class ANAK_PRIA
    Inherits ORANG_TUA
    Private XPria As String
    Private XUsia_P As Byte
    Public Property Nama_Pria() As String
        Get
            Return XPria
        End Get
        Set(ByVal value As String)
            XPria = value
        End Set
    End Property
    Public Property Usia_Pria() As String
        Get
            Return XUsia_P
        End Get
        Set(ByVal value As String)
            XUsia_P = value
        End Set
    End Property
End Class
BIKIN STOPWATCH
siapin 3 button, 1 label, 1 timer (interval 100)
stopwach (vb.net sora7 blog)
stopwach (vb.net sora7 blog)
Public Class Form1
    Dim Mili, Sec, Min, hr As Integer
    Dim Countr As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Mili = 0
        Sec = 0
        Min = 0
        hr = 0
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim mYes_No As String = MsgBox(“Reset timer ?”, vbYesNo)
        If mYes_No = vbYes Then
            Mili = 0
            Sec = 0
            Min = 0
            hr = 0
            Label1.Text = “”
            Timer1.Enabled = False
        End If
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim Mili2, Sec2, Min2, hr2 As String
        Countr = Countr + 1
        Mili2 = Countr
        If Countr = 10 Then
            Sec = Sec + 1
            Countr = 0
        End If
        If Sec = 60 Then
            Min = Min + 1
            Sec = 0
        End If
        If Min = 60 Then
            hr = hr + 1
            Min = 0
        End If
        Sec2 = Format(Val(Sec), “00″)
        Min2 = Format(Val(Min), “00″)
        hr2 = Format(Val(hr), “00″)
        Label1.Text = hr2 & “:” & Min2 & “:” & Sec2 & “:” & Mili2
    End Sub
    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
    End Sub
End Class

Tidak ada komentar:

Posting Komentar