Test PHP

Diposting oleh Unknown

Description: Test PHP
Rating: 4.5
Reviewer: Unknown
ItemReviewed: Test PHP
 

masukan nilai pertama
masukan nilai kedua
Hasil jumlah : + =
More aboutTest PHP

Visual Basic Database

Diposting oleh Unknown

Description: Visual Basic Database
Rating: 4.5
Reviewer: Unknown
ItemReviewed: Visual Basic Database

PROGRAM BERBASIS DATABASE

Membuat Program Berbasis Database (MS.ACCESS 2003)

Membuat Database di Ms. Access 2003

1.        Buatlah sebuah project dengan nama PdbMhs di (drive D:\nama_anda)
2.        Buatlah database dengan menggunakan Ms.Access dengan format 2002-2003 dengan nama dbMhs simpan di (drive D:\nama_anda\PdbMhs\obj\Debug)
3.        Kemudian buat table dengan nama tbMhs
Field Name
Data Type
Keterangan
NIM
Text
FieldSize = 8
Primary Key
Nama
Text
FieldSize = 20
Alamat
Text
FieldSize = 20
Telp
Text
FieldSize = 15
4.        Isi minimal 5 record, bebas!
5.        Tutup Ms.Access


Membuat Program Aplikasi di Visual Basic .NET
1.        Buka Microsoft Visual Studio .NET.
2.        Klik menu View - Server Explorer.
3.        Di Server Explorer – klik kanan Data Connections - pilih Add Connection.
4.        Dalam kotak dialog Data Link Properties, klik tab Provider.
5.        Dalam  OLE DB Provider(s) list - klik Microsoft Jet 4.0 OLE DB Provider - klik Next.
6.        Klik tab Connection, kemudian klik ellipses button (...).
7.        Cari posisi file Access database dbMhs dalam komputer Anda.
8.        Pilih file dbMhs, kemudian klik Open.
9.        Dalam kotak dialog Data Link Properties - OK.
10.    Dalam toolbox – klik tab Data.
11.    Drag OleDbDataAdapter ke Form1.
12.    Dalam  Data Adapter Configuration Wizard - klik Next 3x.
13.    Di panel Generate the SQL statements, ketikan coding di  Microsoft SQL Server  
        Select * from tbMhs
14.    Kemudia klik Next – panel View Wizard Results - klik Finish.

Catatan : Dalam dialog box akan mucul : Do you want to include the password in the connection string? - pilih Don't include password.
15.    Klik kanan pada OleDbDataAdapter1 - klik Generate Dataset.
16.    Di dialog box Generate Dataset  -  OK.
17.    Tambahkan coding pada event Form1_Load:
OleDbDataAdapter1.Fill(DataSet11)
Menampilkan record data dari Database Ms. Access ke form di Visual Basic
1.        Tambahkan DataGrid ke Form1.
2.        Klik kanan DataGrid1 - klik Properties.
3.        Di  Properties atur sbb:
DataSource : DataSet11
DataMember : tbMhs

Menambahkan record baru pada Database Access
1.        Tambah Button ke Form1 atur properties sebagai berikut :
Text          : Add
Name        : btAdd
2.        Klik 2x pada button Add kemudian ketikan coding sbb:
Dim i, NIM As Integer
Dim Nama,Alamat,Telp As String
Dim rw As DataRow
      'menambahkan record pada table tbMHS
        rw = DataSet11.Tables(0).NewRow
        NIM = InputBox("Ketikan NIM:")
        Nama = InputBox("Ketikan Nama:")
        Alamat = InputBox("Ketikan Alamat:")
  Telp = InputBox("Ketikan Telp:") 
        rw.Item("NIM") = NIM
        rw.Item("Nama") = Nama
        rw.Item("Alamat") = Alamat
        rw.Item("Telp") = Telp

        Try
            DataSet11.Tables(0).Rows.Add(rw)
            'Update the Student table in the testdb database.
            i = OleDbDataAdapter1.Update(DataSet11)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        'Displays number of rows updated.
       MessageBox.Show("no of rows updated=" & i)


Script Tambahan Visual Basic

Loading
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start()
    End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim Login As New FrmLogin
        Dim ProgressBar As New Form1
        If ProgressBar1.Value < 100 Then
            ProgressBar1.Value += 2
        ElseIf ProgressBar1.Value = 100 Then
            Timer1.Stop()
            MessageBox.Show("Ujian Akhir Semester Visual Basic: Denny Cahyana !", "Pemberitahuan", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Login.Show()
        End If
    End Sub


Login
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btLogin.Click
        Dim Menu As New FrmMenu
        If txtusername.Text = "denny" And txtpassword.Text = "tuktik" Then
            Menu.Show()
        Else
            MsgBox("Username atau Password yang anda masukan salah !", MsgBoxStyle.Critical)
        End If

    End Sub


CheckedListBox
Clear
For i As Integer = 0 To clbJabatan.Items.Count - 1
            clbJabatan.SetItemChecked(i, False)

        Next

Get Checked
For Each itemChecked In clbJabatan.CheckedItems
        Next
        Dim a As Integer
        For a = 0 To clbJabatan.CheckedItems.Count - 1
            Jabatan = clbJabatan.CheckedItems.Item(a)

        Next
More aboutVisual Basic Database

UTS Visual Basic

Diposting oleh Unknown

Description: UTS Visual Basic
Rating: 4.5
Reviewer: Unknown
ItemReviewed: UTS Visual Basic

Form Login

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents txtuser As System.Windows.Forms.TextBox
    Friend WithEvents txtpass As System.Windows.Forms.TextBox
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.txtuser = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.txtpass = New System.Windows.Forms.TextBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.MainMenu1 = New System.Windows.Forms.MainMenu
        Me.MenuItem1 = New System.Windows.Forms.MenuItem
        Me.MenuItem2 = New System.Windows.Forms.MenuItem
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(16, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(58, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Username"
        '
        'txtuser
        '
        Me.txtuser.Location = New System.Drawing.Point(96, 16)
        Me.txtuser.Name = "txtuser"
        Me.txtuser.Size = New System.Drawing.Size(184, 20)
        Me.txtuser.TabIndex = 1
        Me.txtuser.Text = "TextBox1"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(16, 56)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(56, 16)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "Password"
        '
        'txtpass
        '
        Me.txtpass.Location = New System.Drawing.Point(96, 48)
        Me.txtpass.Name = "txtpass"
        Me.txtpass.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.txtpass.Size = New System.Drawing.Size(184, 20)
        Me.txtpass.TabIndex = 2
        Me.txtpass.Text = "TextBox2"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(104, 96)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(80, 23)
        Me.Button1.TabIndex = 3
        Me.Button1.Text = "&Login"
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2})
        Me.MenuItem1.Text = "Lupa"
        '
        'MenuItem2
        '
        Me.MenuItem2.Index = 0
        Me.MenuItem2.Text = "User & Password"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 129)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.txtpass)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.txtuser)
        Me.Controls.Add(Me.Label1)
        Me.Menu = Me.MainMenu1
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "LOGIN"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtuser.Text = ""
        txtpass.Text = ""
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Menu As New frmmenu
        If txtuser.Text = "denny" And txtpass.Text = "tiktuk" Then
            Menu.Show()
        Else
            MsgBox("Username atau Password yang anda masukan salah !", MsgBoxStyle.Critical)
        End If
    End Sub

    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        Dim Lupa As New frmlupa
        Lupa.Show()
    End Sub
End Class

Form Menu Utama

Public Class frmmenu
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents menupenjualan As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmmenu))
        Me.Button1 = New System.Windows.Forms.Button
        Me.MainMenu1 = New System.Windows.Forms.MainMenu
        Me.MenuItem1 = New System.Windows.Forms.MenuItem
        Me.menupenjualan = New System.Windows.Forms.MenuItem
        Me.MenuItem3 = New System.Windows.Forms.MenuItem
        Me.MenuItem2 = New System.Windows.Forms.MenuItem
        Me.MenuItem4 = New System.Windows.Forms.MenuItem
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(168, 224)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "&Exit"
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem3, Me.MenuItem4})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menupenjualan})
        Me.MenuItem1.Text = "&Menu"
        '
        'menupenjualan
        '
        Me.menupenjualan.Index = 0
        Me.menupenjualan.Text = "&Penjualan"
        '
        'MenuItem3
        '
        Me.MenuItem3.Index = 1
        Me.MenuItem3.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2})
        Me.MenuItem3.Text = "&Help"
        '
        'MenuItem2
        '
        Me.MenuItem2.Index = 0
        Me.MenuItem2.Text = "&Kakulator"
        '
        'MenuItem4
        '
        Me.MenuItem4.Index = 2
        Me.MenuItem4.Text = ""
        '
        'frmmenu
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(248, 261)
        Me.Controls.Add(Me.Button1)
        Me.Menu = Me.MainMenu1
        Me.Name = "frmmenu"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Menu Utama"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmmenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

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

    Private Sub menupenjualan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menupenjualan.Click
        Dim Penjualan As New frmpenjualan
        Penjualan.Show()
    End Sub

    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        Dim Kakulator As New frmkakulator
        Kakulator.Show()
    End Sub
End Class

Form Penjualan

Public Class frmpenjualan
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents txtid As System.Windows.Forms.TextBox
    Friend WithEvents txtnama As System.Windows.Forms.TextBox
    Friend WithEvents txthrg As System.Windows.Forms.TextBox
    Friend WithEvents txtbyk As System.Windows.Forms.TextBox
    Friend WithEvents txthasil As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.txtid = New System.Windows.Forms.TextBox
        Me.txtnama = New System.Windows.Forms.TextBox
        Me.txthrg = New System.Windows.Forms.TextBox
        Me.txtbyk = New System.Windows.Forms.TextBox
        Me.txthasil = New System.Windows.Forms.TextBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button3 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(16, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(16, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "ID"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(16, 48)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(42, 16)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "Barang"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label3.Location = New System.Drawing.Point(16, 80)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(36, 16)
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "Harga"
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label4.Location = New System.Drawing.Point(16, 112)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(43, 16)
        Me.Label4.TabIndex = 3
        Me.Label4.Text = "Banyak"
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label5.Location = New System.Drawing.Point(16, 144)
        Me.Label5.Name = "Label5"
        Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label5.Size = New System.Drawing.Size(31, 16)
        Me.Label5.TabIndex = 4
        Me.Label5.Text = "Hasil"
        '
        'txtid
        '
        Me.txtid.Location = New System.Drawing.Point(72, 16)
        Me.txtid.Name = "txtid"
        Me.txtid.Size = New System.Drawing.Size(168, 20)
        Me.txtid.TabIndex = 5
        Me.txtid.Text = "TextBox1"
        '
        'txtnama
        '
        Me.txtnama.Location = New System.Drawing.Point(72, 48)
        Me.txtnama.Name = "txtnama"
        Me.txtnama.Size = New System.Drawing.Size(168, 20)
        Me.txtnama.TabIndex = 6
        Me.txtnama.Text = "TextBox2"
        '
        'txthrg
        '
        Me.txthrg.Location = New System.Drawing.Point(72, 80)
        Me.txthrg.Name = "txthrg"
        Me.txthrg.Size = New System.Drawing.Size(168, 20)
        Me.txthrg.TabIndex = 7
        Me.txthrg.Text = "TextBox3"
        '
        'txtbyk
        '
        Me.txtbyk.Location = New System.Drawing.Point(72, 112)
        Me.txtbyk.Name = "txtbyk"
        Me.txtbyk.Size = New System.Drawing.Size(168, 20)
        Me.txtbyk.TabIndex = 8
        Me.txtbyk.Text = "TextBox4"
        '
        'txthasil
        '
        Me.txthasil.Location = New System.Drawing.Point(72, 144)
        Me.txthasil.Name = "txthasil"
        Me.txthasil.Size = New System.Drawing.Size(168, 20)
        Me.txthasil.TabIndex = 9
        Me.txthasil.Text = "TextBox5"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(96, 200)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(64, 23)
        Me.Button1.TabIndex = 11
        Me.Button1.Text = "&Help"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(176, 200)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(64, 23)
        Me.Button2.TabIndex = 12
        Me.Button2.Text = "Close"
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(16, 200)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(64, 23)
        Me.Button3.TabIndex = 10
        Me.Button3.Text = "&Clear"
        '
        'frmpenjualan
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(256, 237)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.txthasil)
        Me.Controls.Add(Me.txtbyk)
        Me.Controls.Add(Me.txthrg)
        Me.Controls.Add(Me.txtnama)
        Me.Controls.Add(Me.txtid)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "frmpenjualan"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Penjualan"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmpenjualan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtid.Text = ""
        txtnama.Text = ""
        txthrg.Text = ""
        txtbyk.Text = ""
        txthasil.Text = ""
    End Sub

    Private Sub txtbyk_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtbyk.TextChanged
        Dim hrg, byk, hasil As Integer
        hrg = Val(txthrg.Text)
        byk = Val(txtbyk.Text)
        hasil = hrg * byk
        txthasil.Text = hasil
    End Sub

    Private Sub txthrg_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txthrg.TextChanged
        Dim hrg, byk, hasil As Integer
        hrg = Val(txthrg.Text)
        byk = Val(txtbyk.Text)
        hasil = hrg * byk
        txthasil.Text = hasil
    End Sub

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

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Kakulator As New frmkakulator
        Kakulator.Show()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        txtid.Text = ""
        txtnama.Text = ""
        txthrg.Text = ""
        txtbyk.Text = ""
        txthasil.Text = ""
    End Sub
End Class

Form Kakulator

Public Class frmkakulator
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents txtpertama As System.Windows.Forms.TextBox
    Friend WithEvents txtkedua As System.Windows.Forms.TextBox
    Friend WithEvents txthasil As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents Button5 As System.Windows.Forms.Button
    Friend WithEvents Button6 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.txtpertama = New System.Windows.Forms.TextBox
        Me.txtkedua = New System.Windows.Forms.TextBox
        Me.txthasil = New System.Windows.Forms.TextBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button3 = New System.Windows.Forms.Button
        Me.Button4 = New System.Windows.Forms.Button
        Me.Button5 = New System.Windows.Forms.Button
        Me.Button6 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(8, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(85, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Angka Pertama"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(8, 48)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(74, 16)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "Angka Kedua"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label3.Location = New System.Drawing.Point(8, 120)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(31, 16)
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "Hasil"
        '
        'txtpertama
        '
        Me.txtpertama.Location = New System.Drawing.Point(104, 16)
        Me.txtpertama.Name = "txtpertama"
        Me.txtpertama.TabIndex = 3
        Me.txtpertama.Text = "TextBox1"
        '
        'txtkedua
        '
        Me.txtkedua.Location = New System.Drawing.Point(104, 48)
        Me.txtkedua.Name = "txtkedua"
        Me.txtkedua.TabIndex = 4
        Me.txtkedua.Text = "TextBox2"
        '
        'txthasil
        '
        Me.txthasil.Location = New System.Drawing.Point(104, 120)
        Me.txthasil.Name = "txthasil"
        Me.txthasil.TabIndex = 9
        Me.txthasil.Text = "TextBox3"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(16, 80)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(32, 24)
        Me.Button1.TabIndex = 5
        Me.Button1.Text = "X"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(64, 80)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(32, 24)
        Me.Button2.TabIndex = 6
        Me.Button2.Text = "/"
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(112, 80)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(32, 24)
        Me.Button3.TabIndex = 7
        Me.Button3.Text = "+"
        '
        'Button4
        '
        Me.Button4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button4.Location = New System.Drawing.Point(160, 80)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(32, 24)
        Me.Button4.TabIndex = 8
        Me.Button4.Text = "-"
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(72, 168)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(64, 23)
        Me.Button5.TabIndex = 10
        Me.Button5.Text = "&Clear"
        '
        'Button6
        '
        Me.Button6.Location = New System.Drawing.Point(144, 168)
        Me.Button6.Name = "Button6"
        Me.Button6.Size = New System.Drawing.Size(64, 23)
        Me.Button6.TabIndex = 11
        Me.Button6.Text = "&Close"
        '
        'frmkakulator
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(216, 205)
        Me.Controls.Add(Me.Button6)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.txthasil)
        Me.Controls.Add(Me.txtkedua)
        Me.Controls.Add(Me.txtpertama)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "frmkakulator"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "frmkakulator"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmkakulator_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtpertama.Text = ""
        txtkedua.Text = ""
        txthasil.Text = ""
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        txtpertama.Text = ""
        txtkedua.Text = ""
        txthasil.Text = ""
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Pertama, Kedua, Hasil As Integer
        Pertama = Val(txtpertama.Text)
        Kedua = Val(txtkedua.Text)
        Hasil = Pertama * Kedua
        txthasil.Text = Hasil
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim Pertama, Kedua, Hasil As Integer
        Pertama = Val(txtpertama.Text)
        Kedua = Val(txtkedua.Text)
        Hasil = Pertama / Kedua
        txthasil.Text = Hasil
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim Pertama, Kedua, Hasil As Integer
        Pertama = Val(txtpertama.Text)
        Kedua = Val(txtkedua.Text)
        Hasil = Pertama + Kedua
        txthasil.Text = Hasil
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim Pertama, Kedua, Hasil As Integer
        Pertama = Val(txtpertama.Text)
        Kedua = Val(txtkedua.Text)
        Hasil = Pertama - Kedua
        txthasil.Text = Hasil
    End Sub
End Class
More aboutUTS Visual Basic

Turbo Pascal: Looping Piramid

Diposting oleh Unknown

Description: Turbo Pascal: Looping Piramid
Rating: 4.5
Reviewer: Unknown
ItemReviewed: Turbo Pascal: Looping Piramid

Looping Piramid

Turbo Pascal, Looping Piramid
Gambar: Turbo Pascal, Looping Piramid















Contoh1Looping Piramid For To Do hingga 20
uses wincrt;
var kolom,baris,ulang:integer;
begin
for baris:=1 to 20 do
begin
for kolom:=1 to baris do
begin
write('*');
end;
writeln;
end;
end.

Hasil:
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************
***************
****************
*****************
******************
*******************
********************

Contoh2: Looping Piramid For To Do 20, tiap 5x

uses wincrt;
var kolom,baris,ulang:integer;
begin
for baris:=1 to 20 do
begin
for kolom:=1 to baris do
begin
write('*');
end;
if baris mod 5=0 then
begin
readln;
end;
writeln;
end;
end.


Hasil:
*
**
***
****
*****

******
*******
********
*********
**********

***********
************
*************
**************
***************

****************
*****************
******************
*******************
********************

More aboutTurbo Pascal: Looping Piramid