Tugas 6 Program Dan Aplikasi Komputer

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

TUGAS 6

PROGRAM DAN APLIKASI KOMPUTER

STUDY KASUS VISUAL BASIC.NET

Oleh

Yustika Armelia 03021181621023

UNIVERSITAS SRIWIJAYA
FAKULTAS TEKNIK
JURUSAN TEKNIK PERTAMBANGAN
2017
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Public koneksi As String
Public sql1, sql2 As String
Public conn As SqlClient.SqlConnection = Nothing
Public cmd As SqlClient.SqlCommand = Nothing
Public dtadapter As New SqlClient.SqlDataAdapter
Public dttable As New DataTable
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim h As Integer
Dim i As Integer
Dim j As Integer
Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
'PERINTAH KONEKSI DATABASE DISIMPAN 1 BARIS
koneksi = "Data Source=WINDOWS8\SQLEXPRESS;Initial Catalog=Yustika;Integrated
Security=True"
conn = New SqlClient.SqlConnection(koneksi)
conn.Open()
End Sub
Sub simpan()
'PERINTAH sql1 DISIMPAN 1 BARIS
sql1 = "Insert into Table_1 values('" &
Me.TextBox2.Text & "','" & Me.TextBox4.Text & "','" &
Me.TextBox6.Text & "','" & Me.TextBox8.Text & "','" &
Me.RadioButton1.Text & "','" &
Me.ComboBox1.Text & "')"
cmd = New SqlClient.SqlCommand(sql1)
cmd.Connection = conn
cmd.ExecuteNonQuery()
End Sub
Private Sub RadioButton1_CheckedChanged(sender As System.Object, e As
System.EventArgs) Handles RadioButton1.CheckedChanged
Me.ComboBox1.Items.Remove("suprax")
Me.ComboBox1.Items.Remove("suprafit")
Me.ComboBox1.Items.Add("megapro")
Me.ComboBox1.Items.Add("tiger")
End Sub

Private Sub RadioButton2_CheckedChanged(sender As System.Object, e As


System.EventArgs) Handles RadioButton2.CheckedChanged
Me.ComboBox1.Items.Remove("megapro")
Me.ComboBox1.Items.Remove("tiger")
Me.ComboBox1.Items.Add("suprax")
Me.ComboBox1.Items.Add("suprafit")
End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As


System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.Text = "suprax" Then
a = "15.000.000"
TextBox12.Text = a
End If
If ComboBox1.Text = "suprafit" Then
b = "10.000.000"
TextBox12.Text = b
End If
If ComboBox1.Text = "tiger" Then
c = "24.000.000"
TextBox12.Text = c
End If
If ComboBox1.Text = "megapro" Then
d = "26.000.000"
TextBox12.Text = d
End If

End Sub
Private Sub textbox14_click(sender As System.Object, e As System.EventArgs) Handles
TextBox14.Click
TextBox14.Text = h
h = TextBox12.Text * 5 / 100
End Sub

Private Sub TextBox16_click(sender As System.Object, e As System.EventArgs) Handles


TextBox16.Click
TextBox16.Text = TextBox12.Text - h
End Sub

Private Sub TextBox18_click(sender As System.Object, e As System.EventArgs) Handles


TextBox18.Click
TextBox18.Text = i
i = TextBox12.Text / 10
End Sub

Private Sub TextBox20_click(sender As System.Object, e As System.EventArgs) Handles


TextBox20.Click
TextBox20.Text = j
j = i + TextBox16.Text
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles
Button3.Click
simpan()
End Sub

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


Button1.Click
TextBox2.Text = ""
TextBox4.Text = ""
TextBox6.Text = ""
TextBox8.Text = ""
ComboBox1.Text = ""
TextBox12.Text = ""
TextBox14.Text = ""
TextBox16.Text = ""
TextBox18.Text = ""
TextBox20.Text = ""
End Sub

Private Sub TextBox2_click(sender As System.Object, e As System.EventArgs) Handles


TextBox2.Click
If TextBox2.Text = "" Then
MessageBox.Show("kode harus diisi")
End If
End Sub

End Class

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy