bahasa pemrograman visual

Upload: anonymous-udbkts

Post on 04-Jun-2018

244 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Bahasa Pemrograman Visual

    1/30

  • 8/13/2019 Bahasa Pemrograman Visual

    2/30

  • 8/13/2019 Bahasa Pemrograman Visual

    3/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 3

    STMIK HIMSYA SEMARANG

    Public rstptgs As ADODB.Recordset

    Public Sub BukaDB()Dim STR As String

    Set Conn = New ADODB.ConnectionSet rstmhs = New ADODB.RecordsetSet rstreg = New ADODB.RecordsetSet rstptgs = New ADODB.RecordsetConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbsiregina.mdb"End Sub

    7. Buat rancangan form-form seperti di bawah ini :

    Rancangan Form Menu

    Pengaturan Propertis MenuObyek Propertis Nilai

    Form NameCaptionWindowState

    menusireginaSTMIK HIMSYA SEMARANG2 Maximized

    Label1 NameCaption

    Alignment

    JudulSEMINAR NASIONAL TEKNOLOGI INFORMASI STMIK HIMSYA2 Center

    Timer1 NameInterval

    Timer1100

    Command1 NameCaption

    Command1Kosongkan

    Command2 NameCaption

    Command2STMIK

    Command3 NameCaption

    Command3Kosongkan

  • 8/13/2019 Bahasa Pemrograman Visual

    4/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 4

    STMIK HIMSYA SEMARANG

    Command4 NameCaption

    Command4HIMSYA

    Image1 NamePicture

    Image1Logo Stmik Himsya

    CrystalReport1 NameReportFileNameWindowState

    CR_MhsCari Lokasi File Report Mhs0 crptNormal

    CrystalReport2 NameReportFileNameWindowState

    CR_PtgsCari Lokasi File Report Ptgs0 crptNormal

    CrystalReport3 NameReportFileNameWindowState

    CR_RegCari Lokasi File Report Reg0 crptNormal

    Untuk membuat menu bar :Klik Tools Menu Editor

    Pengaturan Menu seperti berikut ini :Caption : FILEName : mnfileCaption : ExitName : mnexitCaption : DATAName : mndataCaption : Data MahasiswaName : mnmhsCaption : Data RegistrasiName : mnregCaption : REPORTName : mnreportCaption : Laporan Data Mahasiswa

  • 8/13/2019 Bahasa Pemrograman Visual

    5/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 5

    STMIK HIMSYA SEMARANG

    Name : mnlapmhsCaption : Laporan Data RegistrasiName : mnlapreg

    Kode Program MenuDim TEKS As StringDim PT, TK As Integer

    Private Sub mnExit_Click()EndEnd Sub

    Private Sub mnmhs_Click()frmmhs.Showmenusiregina.HideEnd Sub

    Private Sub mnreg_Click()frmRegistrasi.Showmenusiregina.HideEnd Sub

    Private Sub mnlapmhs_Click()CR_Mhs.ReportFileName = App.Path & "\LapDataMhs.rpt"CR_Mhs.WindowState = crptMaximizedCR_Mhs.RetrieveDataFilesCR_Mhs.Action = 1End Sub

    Private Sub mnlapreg_Click()

    CR_Reg.ReportFileName = App.Path & "\LapDataReg.rpt"CR_Reg.WindowState = crptMaximizedCR_Reg.RetrieveDataFilesCR_Reg.Action = 1End Sub

    Private Sub Form_Load()TEKS = Judul.CaptionPT = Len(TEKS)TK = 0End Sub

    Private Sub Timer1_Timer()

    TK = TK + 1If TK = PT + 10 ThenTK = 0

    End IfJudul = Left(TEKS, TK)

    End Sub

  • 8/13/2019 Bahasa Pemrograman Visual

    6/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 6

    STMIK HIMSYA SEMARANG

    Rancangan Form Login

    Pengaturan Propertis Form LoginObyek Propertis Nilai

    Form NameCaption

    FrmLoginLogin

    Label1 NameCaptionBorderStyle

    Label1Nama :1-Fixed Single

    Label2 NameCaption

    BorderStyle

    Label2Password :

    1-Fixed SingleLabel3 Name

    CaptionBorderStyle

    Label3Kode :1-Fixed Single

    Text1 NameText

    TxtNamaPtgsKosongkan

    Text2 NameText

    TxtPinPtgsKosongkan

    Text3 NameText

    TxtKodePtgsKosongkan

    Kode Program Form Login

    Dim A As ByteDim B As Byte

    Private Sub Form_Load()TxtNamaPtgs.MaxLength = 30TxtPinPtgs.MaxLength = 20TxtPinPtgs.PasswordChar = "*"TxtPinPtgs.Enabled = False

  • 8/13/2019 Bahasa Pemrograman Visual

    7/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 7

    STMIK HIMSYA SEMARANG

    TxtKodePtgs.Enabled = FalseEnd Sub

    Private Sub TxtNamaPtgs_KeyPress(Keyascii As Integer)

    Keyascii = Asc(UCase(Chr(Keyascii)))If Keyascii = 27 Then Unload MeIf Keyascii = 13 Then

    Call BukaDBrstptgs.Open "Select NamaPtgs from TPtgs where NamaPtgs =' " & TxtNamaPtgs & " ' ", Conn

    If rstptgs.EOF Then A = A + 1If 1 - A = 0 Then

    MsgBox "Kesempatan ke " & A & " Salah" & Chr(13) & _"Nama '" & TxtNamaPtgs & "' tidak dikenal"

    TxtNamaPtgs = ""TxtNamaPtgs.SetFocus

    ElseIf 2 - A = 0 ThenMsgBox "Kesempatan ke " & A & " Salah" & Chr(13) & _

    "Nama '" & TxtNamaPtgs & "' tidak dikenal"TxtNamaPtgs = ""TxtNamaPtgs.SetFocus

    ElseIf 3 - A = 0 ThenMsgBox "Kesempatan ke " & A & " Salah" & Chr(13) & _

    "Nama '" & TxtNamaPtgs & "' tidak dikenal" & Chr(13) & _"Kesempatan habis, Ulangi dari awal"

    Unload MeExit Sub

    End IfElse

    TxtNamaPtgs.Enabled = False

    TxtPinPtgs.Enabled = TrueTxtPinPtgs.SetFocus

    End IfEnd IfEnd Sub

    Private Sub txtpinptgs_KeyPress(Keyascii As Integer)Keyascii = Asc(UCase(Chr(Keyascii)))If Keyascii = 27 Then Unload MeDim LoginPtgs As StringDim KodePtgs As StringDim NamaPtgs As StringIf Keyascii = 13 Then

    Call BukaDBrstptgs.Open "Select * from TPtgs where NamaPtgs ='" & TxtNamaPtgs & "' and PinPtgs='" &

    TxtPinPtgs & "'", ConnIf rstptgs.EOF Then

    B = B + 1If 1 - B = 0 Then

    MsgBox "Kesempatan ke " & B & " Salah"

  • 8/13/2019 Bahasa Pemrograman Visual

    8/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 8

    STMIK HIMSYA SEMARANG

    TxtPinPtgs = ""TxtPinPtgs.SetFocus

    ElseIf 2 - B = 0 ThenMsgBox "Kesempatan ke " & B & " Salah"

    TxtPinPtgs = ""TxtPinPtgs.SetFocusElseIf 3 - B = 0 Then

    MsgBox "Kesempatan ke " & B & " Salah"'EndUnload MeExit Sub

    End IfElse

    FrmLogin.Visible = Falsemenusiregina.ShowKodePtgs = rstptgs!KodePtgsNamaPtgs = rstptgs!NamaPtgsKodePtgs = KodePtgsNamaPtgs = NamaPtgsfrmRegistrasi.KodePtgs = KodePtgsfrmRegistrasi.NamaPtgs = NamaPtgs

    End IfEnd IfEnd Sub

    Rancangan Form Mahasiswa

  • 8/13/2019 Bahasa Pemrograman Visual

    9/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 9

    STMIK HIMSYA SEMARANG

    Pengaturan Propertis Form Mahasiswa Obyek Propertis Nilai

    Form NameCaption

    FrmMhsStudent Data Entry

    Frame1 s/d Frame5 NameCaption Frame1 s/d Frame5KosongkanLabel1 Name

    Caption Alignment

    JudulStudent Data Entry2-Center

    Label2 NameCaption

    Label2NIM

    Label3 NameCaption

    Label3Nama Mahasiswa

    Label4 NameCaption

    Label3Program Studi

    Label5 NameCaption

    Alignment

    Label5Student Table

    2-CenterText1 NameText

    Text1Kosongkan

    Text2 NameText

    Text2Kosongkan

    Combo1 NameTextList

    Combo1KosongkanSistem Informasi - S1Teknik Informatika - S1

    Command1 NameCaption

    CmdInput&Input

    Command2 NameCaption

    CmdRefresh&Refresh

    Command3 NameCaption CmdHapus&HapusCommand4 Name

    CaptionCmdEdit&Edit

    Command5 NameCaption

    CmdTutup&Tutup

    Timer1 NameInterval

    Timer1100

    DataGrid1 NameDataSource

    DataGrid1 Adodc1

    Adodc1 NameCaptionVisible

    Adodc1MhsFalse

  • 8/13/2019 Bahasa Pemrograman Visual

    10/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 10

    STMIK HIMSYA SEMARANG

    Setting Adodc1 dengan cara klik kanan dan pilih ADODC Properties, seperti tampilan berikut;

    Kode Program Form Mahasiswa

    Dim TEKS As StringDim PT, TK As Integer

    Private Sub Form_Activate()Call BukaDB

    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path &"\dbsiregina.mdb"

    Adodc1.RecordSource = "tmhs" Adodc1.RefreshSet DataGrid1.DataSource = Adodc1DataGrid1.RefreshEnd Sub

    Function CariData()Call BukaDBrstmhs.Open "Select * From tmhs where nim='" & text1 & "'", Conn

  • 8/13/2019 Bahasa Pemrograman Visual

    11/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 11

    STMIK HIMSYA SEMARANG

    End Function

    Private Sub KosongkanText()text1 = ""

    text2 = ""Combo1 = ""End Sub

    Private Sub SiapIsi()text1.Enabled = Truetext2.Enabled = TrueCombo1.Enabled = True

    End Sub

    Private Sub TidakSiapIsi()text1.Enabled = Falsetext2.Enabled = FalseCombo1.Enabled = False

    End Sub

    Private Sub KondisiAwal()KosongkanTextTidakSiapIsicmdINPUT.Caption = "&Input"cmdEdit.Caption = "&Edit"cmdHapus.Caption = "&Hapus"cmdTutup.Caption = "&Tutup"cmdINPUT.Enabled = TruecmdEdit.Enabled = TruecmdHapus.Enabled = True

    End Sub

    Private Sub TampilkanData()With rstmhs

    If Not rstmhs.EOF Thentext2 = rstmhs!namamhsCombo1 = rstmhs!prodi

    End IfEnd With

    End Sub

    Private Sub CmdRefresh_Click()If cmdINPUT.Caption = "&Simpan" Then

    cmdINPUT.SetFocus

    ElseIf cmdEdit.Caption = "&Simpan" ThencmdEdit.SetFocusEnd IfCall KondisiAwalForm_Activate

    End Sub

    Private Sub CmdInput_Click()

  • 8/13/2019 Bahasa Pemrograman Visual

    12/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 12

    STMIK HIMSYA SEMARANG

    If cmdINPUT.Caption = "&Input" ThencmdINPUT.Caption = "&Simpan"cmdEdit.Enabled = FalsecmdHapus.Enabled = False

    cmdTutup.Caption = "&Batal"SiapIsiKosongkanTexttext1.SetFocus

    ElseIf text1 = "" Or text2 = "" Or Combo1 = "" Then

    MsgBox "Data Belum Lengkap...!"Else

    Dim SQLTambah As StringSQLTambah = "Insert Into tmhs (nim,Namamhs,prodi) values ('" & text1 & "','" & text2 & "','" &

    Combo1 & "')"Conn.Execute SQLTambahcmdREFRESH.SetFocus

    End IfEnd If

    End Sub

    Private Sub cmdEdit_Click()If cmdEdit.Caption = "&Edit" Then

    cmdINPUT.Enabled = FalsecmdEdit.Caption = "&Simpan"cmdHapus.Enabled = FalsecmdTutup.Caption = "&Batal"SiapIsitext1.SetFocus

    ElseIf text2 = "" Or Combo1 = "" Then

    MsgBox "Masih Ada Data Yang Kosong"Else

    Dim SQLedit As StringSQLedit = "Update tmhs Set namamhs= '" & text2 & "', prodi= '" & Combo1 & "' where nim= '" &

    text1 & "'"Conn.Execute SQLeditCall KondisiAwalForm_Activate

    End IfEnd If

    End Sub

    Private Sub cmdHapus_Click()

    If cmdHapus.Caption = "&Hapus" ThencmdINPUT.Enabled = FalsecmdEdit.Enabled = FalsecmdTutup.Caption = "&Batal"KosongkanTextSiapIsitext1.SetFocus

    End If

  • 8/13/2019 Bahasa Pemrograman Visual

    13/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 13

    STMIK HIMSYA SEMARANG

    End Sub

    Private Sub CmdTutup_Click()Select Case cmdTutup.Caption

    Case "&Tutup"menusiregina.Showfrmmhs.Hide

    Case "&Batal"TidakSiapIsiKondisiAwal

    End SelectEnd Sub

    Private Sub Text1_KeyPress(Keyascii As Integer)Keyascii = Asc(UCase(Chr(Keyascii)))If Keyascii = 13 Then

    If Len(text1) < 9 ThenMsgBox "nim harus 9 digit"text1.SetFocus

    Elsetext2.SetFocus

    End If

    If cmdINPUT.Caption = "&Simpan" ThenCall CariData

    If Not rstmhs.EOF ThenTampilkanDataMsgBox "nim Sudah Ada"KosongkanTexttext1.SetFocus

    Else

    text2.SetFocusEnd If

    End If

    If cmdEdit.Caption = "&Simpan" ThenCall CariData

    If Not rstmhs.EOF ThenTampilkanDataSiapIsitext1.Enabled = Falsetext2.SetFocus

    ElseMsgBox "nim Tidak Ada"

    KosongkanTexttext1 = ""text1.SetFocus

    End IfEnd If

    If cmdHapus.Enabled = True ThenCall CariData

  • 8/13/2019 Bahasa Pemrograman Visual

    14/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 14

    STMIK HIMSYA SEMARANG

    If Not rstmhs.EOF ThenTampilkanDatapesan = MsgBox("Yakin akan dihapus", vbYesNo)If pesan = vbYes Then

    Dim SQLHapus As StringSQLHapus = "Delete From tmhs where nim= '" & text1 & "'"Conn.Execute SQLHapusCall KondisiAwalcmdREFRESH.SetFocus

    ElseKondisiAwalcmdHapus.SetFocus

    End IfElse

    MsgBox "Data Tidak ditemukan"KosongkanTextText = ""text1.SetFocus

    End IfEnd If

    End IfEnd Sub

    Private Sub Text2_KeyPress(Keyascii As Integer)Keyascii = Asc(UCase(Chr(Keyascii)))If Keyascii = 13 Then

    Combo1.setfocusEnd Sub

    Private Sub Form_Load()text1.MaxLength = 9

    text2.MaxLength = 30KondisiAwal

    TEKS = Judul.CaptionPT = Len(TEKS)TK = 0End SubPrivate Sub Timer1_Timer()TK = TK + 1If TK = PT + 10 Then

    TK = 0End If

    Judul = Left(TEKS, TK)

    End Sub

  • 8/13/2019 Bahasa Pemrograman Visual

    15/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 15

    STMIK HIMSYA SEMARANG

    Rancangan Form Registrasi

    Pengaturan Propertis Form Registrasi

    Obyek Propertis Nilai KeteranganForm Name

    Caption

    FrmRegistrasi

    Registrasi Peserta SeminarFrame1 s/d Frame5 Name

    CaptionFrame1 s/d Frame5Kosongkan

    Picture Picture Bitmap (Logo Stmik Himsya)Label1 Name

    CaptionLabel1SEMINAR NASIONAL

    Label2 NameCaption

    Label2TEKNOLOGI INFORMASI

    Label3 NameCaption

    Label3STMIK HIMSYA

    Label4 NameCaption

    Label4Semarang, 29 November 2013

    Label5 Name

    Caption Alignment

    Judul

    Registration Data Entry2-Center

    Label6 NameCaption

    Label6No. Registrasi :

    Label7 NameCaption

    Label7NIM

    Label8 NameCaption

    Label8Nama Peserta

  • 8/13/2019 Bahasa Pemrograman Visual

    16/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 16

    STMIK HIMSYA SEMARANG

    Label9 NameCaption

    Label9Program Studi

    Label10 NameCaption

    Label10Biaya

    Label11 NameCaption Label11PetugasLabel12 Name

    CaptionBorderStyle

    NamaPtgsKosongkan1-Fixed Single

    Nama Petugas

    Label13 NameCaptionBorderStyle

    KodePtgsKosongkan1-Fixed Single

    Kode Petugas

    Label14 NameCaption

    Label14TABEL PESERTA SEMINAR

    Text1 NameText

    Text1Kosongkan

    No. Registrasi

    Combo1 Name

    Text

    Combo1

    KosongkanText2 NameText

    Text2Kosongkan

    Nama Peserta

    Text3 NameText

    Text3Kosongkan

    Program Studi

    Text4 NameText

    Text4Kosongkan

    Biaya Registrasi

    MaskEdBox1 NameBorderStyle

    MaskEdBox11-mskFixedSingle

    Tanggal Registrasi

    Command1 NameCaption

    CmdInput&Input

    Command2 NameCaption

    CmdRefresh&Refresh

    Command3 NameCaption CmdHapus&HapusCommand4 Name

    CaptionCmdEdit&Edit

    Command5 NameCaption

    CmdTutup&Tutup

    Timer1 NameInterval

    Timer1100

    DataGrid1 NameDataSource

    DataGrid1 Adodc2

    Adodc1 NameCaptionVisible

    Adodc1 Ado_MhsFalse

    Pada setiap Adodc lakukan:1. Klik kanan2. Pilih ADODC Properties

    3. Pada Use Connection String Klik Build4. Pilih Microsoft Jet 4.0 OLE DB

    Provider5. Next6. Klik browse pada kotak Select

    or enter a database name(untuk menentukan lokasi

    Adodc2 NameCaptionVisible

    Adodc2 Ado_RegFalse

    Adodc3 NameCaptionVisible

    Adodc3 Ado_PtgsFalse

  • 8/13/2019 Bahasa Pemrograman Visual

    17/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 17

    STMIK HIMSYA SEMARANG

    direktori database)7. Klik Test Connection (Jika

    belum sukses ulangi dan jikasudah sukses klik OK)

    8. Klik Tab RecordSource9. Pada Command Type, pilih 2-adCmdTable

    10. Pada kotak Table orStored Procedure Name, Pilihnama tabel-nya.

    11. Apply12. OK

    Kode Program Form Registrasi

    Dim TEKS As StringDim PT, TK As Integer

    Private Sub cmdHapus_Click()If cmdHapus.Caption = "&Hapus" Then

    Adodc2.Recordset.DeletecmdINPUT.Enabled = FalsecmdEdit.Enabled = FalsecmdTutup.Caption = "&Batal"KosongkanTextSiapIsitext1.SetFocus

    End IfEnd Sub

    Private Sub Combo1_Click()Call BukaDBrstmhs.Open "select * from tmhs where nim = '" & Combo1 & "'", ConnIf Not rstmhs.EOF Then

    text2 = rstmhs!namamhstext3 = rstmhs!proditext4.SetFocus

    End IfEnd Sub

    Private Sub Form_Activate()Call BukaDB

    Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path &

    "\dbsiregina.mdb" Adodc2.RecordSource = "treg" Adodc2.RefreshSet DataGrid1.DataSource = Adodc2DataGrid1.Refresh

    'jika kode petugas tidak terdeteksi akan munculkan pesan...If KodePtgs = "" Then

  • 8/13/2019 Bahasa Pemrograman Visual

    18/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 18

    STMIK HIMSYA SEMARANG

    MsgBox "Petugas tidak terdeteksi"FrmLogin.ShowExit Sub

    End If

    Call BukaDBrstmhs.Open "tmhs", ConnCombo1.ClearDo Until rstmhs.EOF

    Combo1.AddItem rstmhs!nimrstmhs.MoveNext

    LoopDataGrid1.Enabled = TrueEnd Sub

    Private Sub combo1_keypress(Keyascii As Integer)Keyascii = Asc(UCase(Chr(Keyascii)))If Keyascii = 13 Then

    Call BukaDBrstmhs.Open "select * from tmhs where nim = '" & Combo1 & "'", ConnIf Not rstmhs.EOF Then

    text2 = rstmhs!namamhstext3 = rstmhs!proditext4.Enabled = Truetext4.SetFocusElseMsgBox "nim tidak ditemukan"Combo1.SetFocusExit Sub

    End If'Conn.Close

    End If

    End Sub

    Function CariData()Call BukaDBrstmhs.Open "Select * From tmhs where nim = '" & DBCombo1 & "'", Connrstreg.Open "Select * From treg where noreg = '" & text1 & "'", Connrstptgs.Open "Select * From tptgs where kodeptgs = '" & KodePtgs & "'", Conn

    End Function

    Private Sub KosongkanText()text1 = ""text2 = ""text3 = ""

    text4 = ""Combo1 = ""MaskEdBox1 = ""

    End Sub

    Private Sub SiapIsi()text1.Enabled = Truetext2.Enabled = True

  • 8/13/2019 Bahasa Pemrograman Visual

    19/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 19

    STMIK HIMSYA SEMARANG

    text3.Enabled = Truetext4.Enabled = TrueCombo1.Enabled = TrueMaskEdBox1.Enabled = True

    End SubPrivate Sub TidakSiapIsi()text1.Enabled = Falsetext2.Enabled = Falsetext3.Enabled = Falsetext4.Enabled = FalseCombo1.Enabled = FalseMaskEdBox1.Enabled = False

    End Sub

    Private Sub KondisiAwal()KosongkanTextTidakSiapIsicmdINPUT.Caption = "&Input"cmdEdit.Caption = "&Edit"cmdHapus.Caption = "&Hapus"cmdTutup.Caption = "&Tutup"cmdINPUT.Enabled = TruecmdEdit.Enabled = TruecmdHapus.Enabled = True

    End Sub

    Private Sub TampilkanData()With rstreg

    If Not rstreg.EOF ThenCombo1 = rstreg!nim

    text2 = rstreg!namamhs

    text3 = rstreg!proditext4 = rstreg!biayaMaskEdBox1 = rstreg!tglregtext2.Enabled = Falsetext3.Enabled = Falsetext4.SetFocus

    End IfEnd With

    End Sub

    Private Sub CmdRefresh_Click()If cmdINPUT.Caption = "&Simpan" Then

    cmdINPUT.SetFocus

    ElseIf cmdEdit.Caption = "&Simpan" ThencmdEdit.SetFocusEnd IfCall KondisiAwalForm_Activate

    End Sub

    Private Sub CmdInput_Click()

  • 8/13/2019 Bahasa Pemrograman Visual

    20/30

  • 8/13/2019 Bahasa Pemrograman Visual

    21/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 21

    STMIK HIMSYA SEMARANG

    Case "&Batal"TidakSiapIsiKondisiAwal

    End Select

    End SubPrivate Sub Text1_KeyPress(Keyascii As Integer)Keyascii = Asc(UCase(Chr(Keyascii)))If Keyascii = 13 Then

    If Len(text1) < 15 ThenMsgBox "noreg Harus 15 digit"text1.SetFocus

    Elsetext2.SetFocus

    End IfIf cmdINPUT.Caption = "&Simpan" Then

    Call CariDataIf Not rstreg.EOF Then

    TampilkanDataMsgBox "noreg Sudah Ada"KosongkanTexttext1.SetFocus

    Elsetext2.SetFocus

    End IfEnd IfIf cmdEdit.Caption = "&Simpan" Then

    Call CariDataIf Not rstreg.EOF Then

    TampilkanDataSiapIsi

    text1.Enabled = FalseCombo1.Enabled = Falsetext2.Enabled = Falsetext3.Enabled = Falsetext4.SetFocus

    ElseMsgBox "noreg Tidak Ada"KosongkanTexttext1 = ""text1.SetFocus

    End IfEnd IfIf cmdHapus.Enabled = True Then

    Call CariDataIf Not rstreg.EOF ThenTampilkanDatapesan = MsgBox("Yakin akan dihapus", vbYesNo)If pesan = vbYes Then

    Dim SQLHapus As StringSQLHapus = "Delete From Treg where Noreg= '" & text1 & "'"Conn.Execute SQLHapus

  • 8/13/2019 Bahasa Pemrograman Visual

    22/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 22

    STMIK HIMSYA SEMARANG

    cmdRefresh.SetFocusElse

    KondisiAwalcmdHapus.SetFocus

    End IfElseMsgBox "Data Tidak ditemukan"text1 = " "text1.SetFocus

    End IfEnd If

    End IfEnd Sub

    Private Sub Autonumber()Call BukaDBrstreg.Open ("select * from TReg where NoReg in(select max(NoReg) from TReg) order by NoReg desc"),Connrstreg.Requery

    Dim urutan As String * 15Dim hitung As LongWith rstreg

    If .EOF Thenurutan = "SMIT-291213-" + "001"text1 = urutan

    Elsehitung = Right(!noreg, 3) + 1urutan = "SMIT-291213-" + Right("000" & hitung, 3)

    End Iftext1 = urutanMaskEdBox1 = Format(Now, "dd" & "." & "mm" & "." & "yyyy")

    MaskEdBox1 = DateDataGrid1.Refresh

    End WithEnd Sub

    Private Sub Form_Load()TEKS = Judul.CaptionPT = Len(TEKS)TK = 0

    KodePtgs = FrmLogin.TxtKodePtgsNamaPtgs = FrmLogin.TxtNamaPtgsDataGrid1.Col = 1

    End Sub

    Private Sub Timer1_Timer()TK = TK + 1If TK = PT + 10 Then

    TK = 0End If

    Judul = Left(TEKS, TK)End Sub

  • 8/13/2019 Bahasa Pemrograman Visual

    23/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 23

    STMIK HIMSYA SEMARANG

    REPORT

    Membuat Laporan dengan CRYSTAL REPORT

    Untuk membuat laporan dengan menggunakan crystal report yang pertama pastikan software crystalreport telah terinstallasi di PC.

    Langkah-langkah membuat laporan dengan crystal report 8.5 :

    1. Start All Program Crystal Report

    2. Pilih As a Blank Report atau Using the Report Expert3. Misal kita pilih Using the Report Expert OK Standard OK

    4. Klik tombol Database5. Klik [+] Database Files Find Database File Add

  • 8/13/2019 Bahasa Pemrograman Visual

    24/30

  • 8/13/2019 Bahasa Pemrograman Visual

    25/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 25

    STMIK HIMSYA SEMARANG

    8. Pada kotak dialog Standard Report Expert, tabel TMhs yang akan dibuat laporan akan muncul didalam kotak Tables available for report Next

  • 8/13/2019 Bahasa Pemrograman Visual

    26/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 26

    STMIK HIMSYA SEMARANG

    9. Pilih field-field yang akan ditampilkan pada laporan dengan menge-klik tombol Add-> , dan apabilamenginginkan field-field akan ditampilkan semua, maka klik tombol Add All-> , selanjutnya kliktombol Next Finish .

    10. Simpan Laporan dalam folder yang telah dibuat sebelumnya dan beri nama LapDataMhs

    11. Untuk memodifikasi tampilan laporan, lakukan klik pada tab Design

  • 8/13/2019 Bahasa Pemrograman Visual

    27/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 27

    STMIK HIMSYA SEMARANG

    12. Untuk memodifikasi tampilan laporan, dapat dilakukan dengan memanfaatkan tools-tools padamenu bar.

    13. Buat report untuk Registasi dengan cara seperti langkah-langkah sebelumnya.14. Kemudian simpan report tersebut dengan nama file LapDataReg.

  • 8/13/2019 Bahasa Pemrograman Visual

    28/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 28

    STMIK HIMSYA SEMARANG

    MEMBUAT SPLASH SCREEN DAN PROGRESSBAR

    1. Klik kanan pada form FrmLogin Add Form Splash Screen Open

    2. Tampilan awal frmsplash

    3. Tambahkan components Microsoft Windows Common Controls 5.0 (SP2) atau 6.0 (SP6).

  • 8/13/2019 Bahasa Pemrograman Visual

    29/30

    MODUL Bahasa Pemrograman Visual 1

    Solikhin Halaman 29

    STMIK HIMSYA SEMARANG

    4. Modifikasi frmsplash :- Edit picture dan label-label bawaan splashscreen (diganti logo Stmik Himsya, tulisan

    seperti tampilan di bawah ini- Tambahkan ProgressBar- Tambahkan Timer- Tambahkan Label

    Pengaturan Properties

    Obyek Propertis NilaiFrmSplash Name FrmSplashSiregina

    ProgressBar Name ProgressBarTimer1 Name

    IntervalTimer1100

    Label Name LabelBar

    Kode Program SplashScreen

    Option Explicit

    Private Sub Form_KeyPress(KeyAscii As Integer)Unload Me

    End Sub

    Private Sub Form_Load()'lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision'lblProductName.Caption = App.Title

    End Sub

  • 8/13/2019 Bahasa Pemrograman Visual

    30/30