Anda di halaman 1dari 20

BAB II

PENGENALAN VISUAL BASIC

2.1 Tujuan Praktikum


1. Praktikan dapat memahami dan mengenal Visual Basic serta object control
yang berada di dalamnya.
2. Praktikan dapat membuat aplikasi menggunakan object control pada
Visual Basic.

2.2 Dasar Teori


Visual Basic (Beginners All-Purpose Symbolic Instruction Code)
merupakan bahasa pemrograman tingkat tinggi (high level language) yang lebih
mudah digunakan, lebih portable (mudah diadaptasikan) antar platform, dan lebih
abstrak. Visual Basic dapat digunakan untuk membuat suatu aplikasi yang dapat
berjalan dalam sistem operasi Windows. Visual Basic menggunakan metode
Graphical User Interface (GUI) dalam pembuatan program aplikasi (project).
Istilah visual mengacu pada metode pembuatan tampilan program (interface), atau
objek pemrograman yang dapat dilihat langsung oleh programmer.

2.2.1 Pengenalan Visual Basic


1. Platform .NET Framework
Microsoft. NET yang awalnya disebut Next Generation Windows Services
(NGWS) adalah suatu platform untuk membangun dan menjalankan
generasi penerus aplikasi terdistribusi
2. Visual Basic.NET
Visual Basic.NET (atau VB.NET) merupakan salah satu bahasa
pemrograman yang difokuskan untuk pengembangan aplikasi desktop,
Visual Basic.NET memungkinkan para pengembang membangun
bermacam aplikasi, baik desktop maupun aplikasi web.

Laporan Sementara Praktikum Pemrograman Komputer 2016 2


3. IDE Visual Basic.NET
IDE (Integrated Development Environment) atau juga disebut sebagai
Integrated Design/Debugging Environment adalah perangkat lunak
komputer yang berfungsi untuk membantu pemrogram dalam
mengembangkan perangkat lunak.
4. Komponen IDE Visual Basic.NET
Menu Bar
Toolbar
Toolbox
Form
Windows Properties
Project Explorer

2.2.2 Object Control pada Visual Basic


Pada Visual Basic, pemrograman dilakukan dengan menggunakan
komponen-komponen yang tersedia pada toolbox. Komponen yang termasuk
dalam toolbox Common Controls antara lain:
a. Button
b. Check Box
c. Checked List Box
d. Combo Box
e. Date Time Picker
f. Label
g. Link Label
h. List Box
i. List View
j. Masked Text Box
k. Month Calendar
l. Notify Icon
m. Numeric Up Down
n. Picture Box, dll.

Laporan Sementara Praktikum Pemrograman Komputer 2016 3


2.3 Form
2.3.1 Form Home

Gambar 2.1 Form Home

Tabel 2.1 Properties toolbox form Home


Objek Properties Nilai
Form1 Name Form1
Image Image-1
Text Home
Picturebox1 Name Picturebox1
Image Image-2
Picturebox2 Name Picturebox2
Image Image-3
Picturebox3 Name Picturebox3
Image Image-4
Label1 Name Label1
Font Bernard MT Condensed,
27.75pt, style=Italic
Text Wellcome to Sihotang's
WIFI

Laporan Sementara Praktikum Pemrograman Komputer 2016 4


Tabel 2.1 (Lanjutan)
Objek Properties Nilai
Label2 Name Label2
Font Times New Roman, 14.25pt
Text First Join Us as a Members
Label3 Name Label3
Font Bernard MT Condensed,
20.25pt
Text OPEN 24 HOURS
BackColor Aqua
ForeColor Red
Label4 Name Label4
Font Times New Roman,
14.25pt, style=Bold, Italic
Text Search Us:
LinkLabel1 Name LinkLabel1
Font Times New Roman, 12pt
Text Situs Update Promo WIFI
LinkLabel2 Name LinkLabel2
Font Times New Roman, 12pt
Text Contact Person
Button1 Name Button1
Font Microsoft Sans Serif, 12pt,
style=Bold
Text SIGN UP
BackColor Red
ForeColor ControlLightLight
Panel1 Name Panel1
Timer1 Name Timer1
Enabled True
Interval 500

Laporan Sementara Praktikum Pemrograman Komputer 2016 5


2.3.2 Form Biodata Member

Gambar 2.2 Form Biodata Member

Tabel 2.2 Properties toolbox form Biodata Member


Objek Properties Nilai
Form2 Name Form2
Text Biodata Member
Label1 Name Label1
Font Times New Roman, 12pt
Text Nama
Label2 Name Label2
Font Times New Roman, 12pt
Text Kode Member
Label3 Name Label3
Font Times New Roman, 12pt
Text Tanggal Lahir
Label4 Name Label4
Font Times New Roman, 12pt
Text Jenis Kelamin
Label5 Name Label5
Font Times New Roman, 12pt
Text Nomor Hp
Label6 Name Label6
Font Times New Roman, 12pt
Text Nomor Id
Label7 Name Label7
Font Times New Roman, 12pt
Text Informasi

Laporan Sementara Praktikum Pemrograman Komputer 2016 6


Tabel 2.2 (Lanjutan)
Objek Properties Nilai
Label8 Name Label8
Font Times New Roman, 14.25pt
Text Biodata Member
Label9 Name Label9
Font Times New Roman, 14.25pt
Silahkan membeli paket
Text wifi pada menu pilihan
paket via potong pulsa

ToolStripLabel1 Name ToolStripLabel1


Text NEW
ToolStripLabel2 Name ToolStripLabel2
Text SAVE
ToolStripLabel3 Name ToolStripLabel3
Text OPEN
Button1 Name Button1
Font Times New Roman, 12pt,
style=Bold
Text PROSES
BackColor Lime
Button2 Name Button2
Font Times New Roman, 12pt,
style=Bold
Text KELUAR
BackColor Red
Button3 Name Button3
Font Times New Roman, 12pt,
style=Bold
Text PRINT
BackColor Lime
Button4 Name Button4
Image Image-5
Button5 Name Button5
Font Bernard MT Condensed,
14.25pt, style=Italic
Text Halaman Sebelumnya
BackColor Red
TextBox1 Name TextBox1
Font Times New Roman, 12pt
TextBox2 Name TextBox2
Font Times New Roman, 12pt

Laporan Sementara Praktikum Pemrograman Komputer 2016 7


Tabel 2.2 (Lanjutan)
Objek Properties Nilai
TextBox3 Name TextBox3
Font Times New Roman, 12pt
TextBox4 Name TextBox4
Font Times New Roman, 12pt
RichTextBox1 Name RichTextBox1
ListBox1 Name ListBox1
Font Times New Roman, 12pt
Items Teman
Saudara
Online
Kos-kos an
ComboBox1 Name ComboBox1
Font Times New Roman, 12pt
Items MBR 12 hours
MBR 1 week
MBR 1 month
DateTimePicker1 Name DateTimePicker1
Font Times New Roman, 12pt

Laporan Sementara Praktikum Pemrograman Komputer 2016 8


2.3.3 Form Pemilihan Paket

Gambar 2.3 Form Pemilihan Paket

Tabel 2.3 Properties toolbox form Pemilihan Paket


Objek Properties Nilai
Form3 Name Form3
Text Pemilihan Paket
Label1 Name Label1
Font Times New Roman,
14.25pt, style=Bold, Italic
Pilihan Paket Via Potong
Text Pulsa (Telkomsel, Indosat,
XlL & Axis)
BackColor HotPink
Label2 Name Label2
Font Times New Roman,
14.25pt, style=Bold 12
Text 1 HOURS : Rp.5000,-
BackColor Aqua
Label3 Name Label3
Font Times New Roman, 12pt
Text Untuk pembelian paket wifi
12 JAM,

Laporan Sementara Praktikum Pemrograman Komputer 2016 9


Tabel 2.3 (Lanjutan)
Objek Properties Nilai
Label4 Name Label4
Font Times New Roman, 11.25pt
kirim sms ke
Text 085800086541 (khusus
pelanggan Telkomsel,
Indosat, XL, & Axis) ketik:
Label5 Name Label5
Font Times New Roman, 12pt,
style=Bold
Text NET<spasi>Nominal
Paket<spasi>xjy7c
Label6 Name Label6
Font Times New Roman, 11.25pt
Pembelian paket berhasil?
Text Klik tombol dibawah ini
untuk melanjutkan
browsing,
Label7 Name Label7
Font Times New Roman, 11.25pt
atau masukkan username
Text dan password anda pada
Form User Login
Label8 Name Label8
Font Times New Roman,
14.25pt, style=Bold 12
Text 1 WEEK : Rp.20.000,-
BackColor Aqua
Label9 Name Label9
Font Times New Roman,
14.25pt, style=Bold
Text 1 MONTH : Rp.50.000,-
BackColor Aqua
Button1 Name Button1
Font Times New Roman,
15.75pt, style=Bold
Text BELI
BackColor Red
ForeColor ControlLightLight

Laporan Sementara Praktikum Pemrograman Komputer 2016 10


Tabel 2.3 (Lanjutan)
Objek Properties Nilai
Button2 Name Button2
Font Bernard MT Condensed,
14.25pt, style=Italic
Text Halaman Sebelumnya
BackColor Red

2.3.4 Form User Login

Gambar 2.4 Form User Login

Tabel 2.4 Properties toolbox form User Login


Objek Properties Nilai
Form4 Name Form4
Text User Login
Label1 Name Label1
Font Times New Roman, 18pt,
style=Bold, Italic
Text Sihotang's WIFI
BackColor Red
ForeColor ControlLightLight
Label2 Name Label2
Font Times New Roman,
14.25pt, style=Bold
Text User Login

Laporan Sementara Praktikum Pemrograman Komputer 2016 11


Tabel 2.4 (Lanjutan)
Objek Properties Nilai
Label3 Name Label3
Font Times New Roman, 12pt
Text Username
ForeColor Red
Label4 Name Label4
Font Times New Roman, 12pt
Text Password
ForeColor Red
TextBox1 Name TextBox1
Font Times New Roman, 12pt
TextBox2 Name TextBox2
Font Times New Roman, 12pt
Button1 Name Button1
Font Times New Roman,
14.25pt, style=Bold
Text LOGIN
ForeColor ControlLightLight
BackColor Red
Button2 Name Button2
Font Bernard MT Condensed,
14.25pt, style=Italic
Text Halaman Sebelumnya
BackColor Red

Laporan Sementara Praktikum Pemrograman Komputer 2016 12


2.4 Listing Program
2.4.1 Listing Program Form Home

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Me.Hide()
Form2.Show()
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles


Timer1.Tick
Label3.Left = Label3.Left - 20
If Label3.Left <= Panel1.Location.X - 350 Then
Label3.Left = Panel1.Width
End If
End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Me.LinkLabel1.LinkVisited = True
System.Diagnostics.Process.Start("http://my.telkom.co.id")
End Sub

Private Sub LinkLabel2_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
Me.LinkLabel2.LinkVisited = True
System.Diagnostics.Process.Start("http://my.telkom.co.id")
End Sub

End Class

2.4.2 Listing Program Form Biodata Member

Public Class Form2


Private Sub ToolStripLabel1_Click(sender As Object, e As EventArgs)
Handles ToolStripLabel1.Click
TextBox1.Text = ""
ComboBox1.Text = ""
DateTimePicker1.Value = Now
TextBox4.Text = ""
TextBox2.Text = ""

Laporan Sementara Praktikum Pemrograman Komputer 2016 13


TextBox3.Text = ""
ListBox1.SelectedIndex = -1
RichTextBox1.Text = ""
End Sub

Private Sub ToolStripLabel2_Click(sender As Object, e As EventArgs)


Handles ToolStripLabel2.Click
SaveFileDialog1.ShowDialog()
End Sub

Private Sub ToolStripLabel3_Click(sender As Object, e As EventArgs)


Handles ToolStripLabel3.Click
OpenFileDialog1.ShowDialog()
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
RichTextBox1.Text = "Nama : " & TextBox1.Text & vbCrLf
RichTextBox1.Text = RichTextBox1.Text & "Kode Member: " &
ComboBox1.Text & vbCrLf
RichTextBox1.Text = RichTextBox1.Text & "Tanggal Lahir: " &
DateTimePicker1.Value & vbCrLf
RichTextBox1.Text = RichTextBox1.Text & "Jenis Kelamin: " &
TextBox4.Text & vbCrLf
RichTextBox1.Text = RichTextBox1.Text & "Nomor Hp: " &
TextBox2.Text & vbCrLf
RichTextBox1.Text = RichTextBox1.Text & "Nomor Id: " & TextBox3.Text
& vbCrLf
RichTextBox1.Text = RichTextBox1.Text & "Informasi: " & ListBox1.Text
& vbCrLf
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles


Button3.Click
PrintDialog1.ShowDialog()
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles


Button4.Click
Me.Hide()
Form3.Show()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
Dim keluar As MsgBoxResult

Laporan Sementara Praktikum Pemrograman Komputer 2016 14


keluar = MsgBox("Apakah Anda yakin ingin keluar?",
MsgBoxStyle.OkOnly, "Peringatan")
keluar = MsgBoxResult.Ok
Close()
End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles


Button5.Click
Me.Hide()
Form1.Show()
End Sub
End Class

2.4.3 Listing Program Form Pemilihan Paket

Public Class Form3


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Me.Hide()
Form4.Show()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
Me.Hide()
Form2.Show()
End Sub
End Class

2.4.4 Listing Program Form User Login

Public Class Form4


Private Sub Form4_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
TextBox1.MaxLength = 7
TextBox2.PasswordChar = "*"
TextBox1.Clear()
TextBox2.Clear()
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click

Laporan Sementara Praktikum Pemrograman Komputer 2016 15


Dim LOGIN As MsgBoxResult
LOGIN = MsgBox("Selamat Anda terhubung dengan Wifi kami!",
MsgBoxStyle.OkOnly)
LOGIN = MsgBoxResult.Ok
Close()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
Me.Hide()
Form3.Show()
End Sub
End Class

Laporan Sementara Praktikum Pemrograman Komputer 2016 16


2.5 Running Program
2.5.1 Running Program Form Home

Gambar 2.5 Running Program Form Home

2.5.2 Running Program Form Biodata Member

Gambar 2.6 Running Program Form Biodata Member

Laporan Sementara Praktikum Pemrograman Komputer 2016 17


Gambar 2.7 Running Program Form Biodata Member

Gambar 2.8 Running Program Form Biodata Member

Laporan Sementara Praktikum Pemrograman Komputer 2016 18


Gambar 2.9 Running Program Form Biodata Member

Gambar 2.10 Running Program Form Biodata Member

Laporan Sementara Praktikum Pemrograman Komputer 2016 19


Gambar 2.11 Running Program Form Biodata Member

2.5.3 Running Program Form Pemilihan Paket

Gambar 2.12 Running Program Form Pemilihan Paket

Laporan Sementara Praktikum Pemrograman Komputer 2016 20


2.5.3 Running Program Form User Login

Gambar 2.13 Running Program Form User Login

Gambar 2.14 Running Program Form User Login

Laporan Sementara Praktikum Pemrograman Komputer 2016 21