dasar pemrograman 1 pemrograman visual basic 6.0
DESCRIPTION
Dasar Pemrograman 1 Pemrograman Visual Basic 6.0. Iwan santosa, ST. What is Visual Basic?. Visual Basic is a tool that allows you to develop Windows (Graphic User Interface - GUI ) applications. The applications have a familiar appearance to the user. - PowerPoint PPT PresentationTRANSCRIPT
Dasar Pemrograman 1Pemrograman Visual
Basic 6.0
Iwan santosa, ST
What is Visual Basic?
Visual Basic is a tool that allows you to develop Windows (Graphic User Interface - GUI) applications. The applications have a familiar appearance to the user.
Visual Basic is event-driven, meaning code remains idle until called upon to respond to some event (button pressing, menu selection, ...).
Application (Project) Forms - Windows that you create for user interface Controls - Graphical features drawn on forms to allow user
interaction (text boxes, labels, scroll bars, command buttons, etc.) (Forms and Controls are objects.)
Properties - Every characteristic of a form or control is specified by a property. Example properties include names, captions, size, color, position, and contents. Visual Basic applies default properties. You can change properties at design time or run time.
Methods - Built-in procedure that can be invoked to impart some action to a particular object.
Event Procedures - Code related to some object. This is the code that is executed when a certain event occurs.
General Procedures - Code not related to objects. This code must be invoked by the application.
Modules - Collection of general procedures, variable declarations, and constant definitions used by application.
Kontrol Menu
Restore Move Size Minimize Maximize Close
Lingkungan
Floating Sizeable Dockable
Menu
Dengan Mouse Dengan Keyboard
Main Window
Toolbox
Project Explorer
Windows Properties
Form Layout Windows
Jendela Kode
Membuka Aplikasi Baru
Keterangan Singkat Standart EXE
Membuat aplkasi visual basic standart (umum) ActiveX EXE
Membuat aplikasi activeX ActiveX DLL
Membuat Library ActiveX activeX Control
Membuat kontrol activeX VB Application Wizard
Membuat aplikasi VB dengan bantuan wizard VB Wizard Manager
IPusat Pengelolaan Wizard Visual Basic IIS Aplication
Membuat aplikasi IIS (Internet Information Server) DHTML Application
Membuat aplikasi DHTML
Membuka Aplikasi Yang Sudah ada
Alur Program VB
EVENT
PROSES
HASIL
USER
METODE
SYSTEM
Bagian KodeAPLIKASI VB
KODE FORM
KODE KONTROL
KODE KONTROL
KODE MODUL
Structure of a Visual Basic Application
Penggunaan jendela Kode
Arti Warna text Pada Umumnya Biru
Text ini merupakan kata kunci (reserved word) Hijau
Text ini merupakan keterangan Hitam
Tulisan biasa (kode, nama variabel dan yang lainnya) Merah
Kode program yang salah
Bantuan Pada jendela kode
Tool Tips Otomasi variabel Jendela Attribut
Data, Variabel dan Konstanta
Type Data Integer
Type data berupa bilangan bulat (-32.768 – 32.767) Byte Decimal String Single Double Date Currency Long Object Varinant
Variabel
Merupakan tempat penyimpanan sementara
VARIABEL
Proses Pergantian Nilai Variabel
Si Usrok
USER
METODESi Usrok Si Unyil
Si Usrok
Si Unyil
Deklarasi Variabel
Variabel dideklarasikan dengan Dim Sintaksnya
Dim namavariabel As Type Data Contoh
Dim Nama As String Dim No As Integer Dim TglLahir As Date
Variabel Global dan Local
Variabel Global : variabel yang dapat diakses dari semua lokasi di dalam program. Contoh
PUBLIC Counter As Integer (Pendeklarasian di Jendela modul kode)
Variabel Lokal : variabel yang hanya dapat digunakan di lingkungannya sendiri. Contoh
Pendeklarasian variabel di dalam event
Pemberian Nama Variabel
Nama diberikan untuk memperjelas kegunaan variabel tersebut
Tipe Data Awalan Contoh
Boolean Bln BlnStatus
Integer Int IntTotal
Single Sng SngJumlah
Aturan Suffix
Dim No As Integer Bisa dipersingkat Dim No%
Tipe Data Simbol
Integer %
Long &
Single !
Double #
String $
Currency @
Konstanta
Media Penympanan nilai yang bersifat tetap Contoh : TotalBiaya = 0,5*Produksi + Ovr Dimana Ovr = 500000 Ovr = KONSTANTA
Cara Penuliasan konstanta
Const namakonstanta As Tipe = Nilai
Operator
Macam-macam Operator Operator Aritmetik Operator Perbandingan Operator Logika
Operator Aritmatika
Operator yang dilakukan untuk melakukan perhitungan mamtematis.
Operator Arti Contoh
+ Penjumlahan X=4+6
- Pengurangan X=4-6
* Perkalian X=4*6
/ Pembagian X=4^6
^ Perpangkatan X=4/6
& Penggambungan String Str1&Str2
Tingkat Urutan
Pangkat Perkalian dan Pembagian Penjumlahan dan pengurangan
Contoh Total = 2*5+3^2 =2*5+9 =10+9 =19
Operator Perbandingan
Contoh Jumlah >=10
Operator Arti
= Sama Dengan
> Lebih Besar
< Lebih Kecil
>= Lebih Besar atau sama
<= Kurang dari atau sama dengan
<> Tidak samadengan
Operator Logika
Operator Arti
AND Akan bernilai true jika kedua nilai yang dibandingkan juga true
OR Akan bernilai true jika salah satu nilai yang dibandingkan bernilai True
NOT Akan bernilai true jika yang dibandingkan bernilai false