Kamis, 09 Juni 2011

Materi 19 Mei 2011

Cristal Report
1. Klik kanan nama project → Add → Klik kanan Item → Reporting → Klik Crystal Report → Add → OK
• Pilih create new connection
• Klik OLEDB (ADO)
• Pilih Microsoft OLEDB Provider for SQL Server
2. Isi Server = . (untuk local)
User ID
Password
Database (pilih database)
Integrated Security → x
3. Klik next → Klik Table pada database (selected table) → Klik Next → Klik Dropdown pada avaible fields → Next → Pilih dalam avaible style (drop table)

Memasukan Table
1. Klik pada toolbox (Crystal report viewer) → Klik kanan pada form (choose crystal report) → Pilih file Crystal Report then → Klik OK

Membuat Menu
1. Klik kanan → Add → New Item → Klik Windows Form → Pilih MDI Parent Form

Senin, 06 Juni 2011

Form Koneksi ke Database


Public Class Form1

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

    End Sub
    Sub Jurusan()
        Call bukakoneksi()
        Tampil2.Connection = database
        Tampil2.CommandType = CommandType.Text
        tampil2.CommandText = "select * from jurusan where kdjur='" & Trim(TextBox1.Text) & "'"
        Tampilkan = Tampil2.ExecuteReader

        If Tampilkan.HasRows = True Then
            While Tampilkan.Read()
                If IsDBNull(tampilkan("kdjur")) Then
                Else
                    TextBox2.Text = tampilkan("nmjur")
                End If
            End While
        End If
    End Sub

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

    End Sub
End Class

Form Login


Public Class LoginForm1
Private Sub OK_Click (By Val sender As System.Object, ByVal e As System Event Args) Hendles OK.Click
If UsernameTextBox .Text = “indah” And PasswordTextBox.Text = “siap” Then
MDIParent1.Show ()
Me Visible = False
Else
MsgBox (“Login Gagal, Coba Ulangi Lagi”)
End If
End Sub
Private Sub Cancel_Click
Me.Close ()
End Sub
End Class