Kamis, 09 Juni 2011

LANJUUUUUUUUUTTTTTTTTTTT...............

Nah Form lanjutan yg aku buat nie..........


Untuk source code :

Public Class Data_Pengecekan
Sub recording()
Call bukakoneksi()
tampil2.Connection = database
tampil2.CommandType = CommandType.Text
tampil2.CommandText = "Insert into pengecekan(nocek,noterima,kode_sup,kode_mat,nama_mat,type,nama_pet,jumlah,tgl_cek,qtyNG,qtyOK,status)values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "','" & DateTimePicker1.Value & "','" & TextBox9.Text & "','" & TextBox10.Text & "','" & TextBox11.Text & "')"
tampil2.ExecuteNonQuery()
End Sub
Sub kodesama()
Call bukakoneksi()
tampil2.Connection = database
tampil2.CommandType = CommandType.Text
tampil2.CommandText = "select * from pengecekan where nocek='" & TextBox1.Text & "'"
tampilkan = tampil2.ExecuteReader()
If tampilkan.HasRows = True Then
hasilcek = "True"
Else
hasilcek = "False"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text = "Input" Then
Button1.Text = "Save"
Button2.Enabled = "false"
Button3.Enabled = "false"
Button4.Text = "Batal"
TextBox1.Focus()
Else
If TextBox1.Text = "" Then Exit Sub
If TextBox2.Text = "" Then Exit Sub
If TextBox3.Text = "" Then Exit Sub
If TextBox4.Text = "" Then Exit Sub
If TextBox5.Text = "" Then Exit Sub
If TextBox6.Text = "" Then Exit Sub
If TextBox7.Text = "" Then Exit Sub
If TextBox8.Text = "" Then Exit Sub
If TextBox9.Text = "" Then Exit Sub
If TextBox10.Text = "" Then Exit Sub
If TextBox11.Text = "" Then Exit Sub
Call kodesama()
If hasilcek = "True" Then
MsgBox("Data sudah ada , silahkan cek data yang akan diinput ", MsgBoxStyle.Critical, "Input data")
Else
Call recording()
End If
Call bersih()
End If
End Sub
Sub bersih()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
End Sub
Sub hapusrecord()
If Button3.Text = "Hapus" Then
TextBox1.Text = " "
Button3.Text = "Ok"
Button1.Enabled = False
Button2.Enabled = False
Button4.Text = "Batal"
TextBox1.Focus()
Else
If TextBox1.Text = "" Then Exit Sub
If TextBox2.Text = "" Then Exit Sub
If TextBox3.Text = "" Then Exit Sub
If TextBox4.Text = "" Then Exit Sub
If TextBox5.Text = "" Then Exit Sub
If TextBox6.Text = "" Then Exit Sub
If TextBox7.Text = "" Then Exit Sub
If TextBox8.Text = "" Then Exit Sub
If DateTimePicker1.Value = "" Then Exit Sub
If TextBox9.Text = "" Then Exit Sub
If TextBox10.Text = "" Then Exit Sub
If TextBox11.Text = "" Then Exit Sub
Try
Call bukakoneksi()
tampil2.Connection = database
tampil2.CommandType = CommandType.Text
tampil2.CommandText = " Delete from pengecekan where nocek='" & Trim(TextBox1.Text) & "'"
tampil2.ExecuteNonQuery()
Call bersih()
TextBox1.Focus()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Call hapusrecord()
End Sub
Sub edittable()
If Button2.Text = "Edit" Then
Button2.Text = "Simpan"
Button2.Enabled = True
Button1.Text = "Input"
Button1.Enabled = False
Button3.Text = " Hapus"
Button3.Enabled = False
Button4.Text = "Batal"
TextBox1.Focus()
Else
If TextBox1.Text = "" Then Exit Sub
If TextBox2.Text = "" Then Exit Sub
If TextBox3.Text = "" Then Exit Sub
If TextBox4.Text = "" Then Exit Sub
If TextBox5.Text = "" Then Exit Sub
If TextBox6.Text = "" Then Exit Sub
If TextBox7.Text = "" Then Exit Sub
If TextBox8.Text = "" Then Exit Sub
If DateTimePicker1.Value = "" Then Exit Sub
If TextBox9.Text = "" Then Exit Sub
If TextBox10.Text = "" Then Exit Sub
If TextBox11.Text = "" Then Exit Sub
Try
Call bukakoneksi()
tampil2.Connection = database
tampil2.CommandType = CommandType.Text
tampil2.CommandText = " Update pengecekan set noterima='" & TextBox2.Text & "',kode_sup='" & TextBox3.Text & "',kode_mat='" & TextBox4.Text & "',nama_mat='" & TextBox5.Text & "',type='" & TextBox6.Text & "',nama_pet='" & TextBox7.Text & "',jumlah='" & TextBox8.Text & "',tgl_cek='" & DateTimePicker1.Value & "',qtyNG='" & TextBox9.Text & "' ,qtyOK='" & TextBox10.Text & "',status='" & TextBox11.Text & "',where nocek='" & TextBox1.Text & "'"
tampil2.ExecuteNonQuery()
Call bersih()
TextBox1.Focus()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Call edittable()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If Button4.Text = "Keluar" Then
Me.Close()
Else
Call bersih()
Call normal()
End If
End Sub
Sub normal()
Button1.Text = "Input"
Button1.Enabled = "true"
Button2.Text = "Edit"
Button2.Enabled = "true"
Button3.Text = "Hapus"
Button3.Enabled = "true"
Button4.Text = "Keluar"
Button4.Enabled = "true"
End Sub
Private Sub Data_Pengecekan_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Call bersih()
End Sub
End Class



Nah, Form Lainnya :


Terus source codenya :

Public Class Data_Material
Dim tgl As Date
Sub recording()
Call bukakoneksi()
tampil2.Connection = database
tampil2.CommandType = CommandType.Text
tampil2.CommandText = "Insert into datamaterial (kode_mat,nama_mat,Qty,tgl,type)values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & DateTimePicker1.Value & "','" & TextBox4.Text & "')"
tampil2.ExecuteNonQuery()
End Sub
Sub kodesama()
Call bukakoneksi()
tampil2.Connection = database
tampil2.CommandType = CommandType.Text
tampil2.CommandText = "select * from datamaterial where kode_mat='" & TextBox1.Text & "'"
tampilkan = tampil2.ExecuteReader()
If tampilkan.HasRows = True Then
hasilcek = "True"
Else
hasilcek = "False"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text = "Input" Then
Button1.Text = "Save"
Button2.Enabled = "false"
Button3.Enabled = "false"
Button4.Text = "Batal"
TextBox1.Focus()
Else
If TextBox1.Text = "" Then Exit Sub
If TextBox2.Text = "" Then Exit Sub
If TextBox3.Text = "" Then Exit Sub
Call kodesama()
If hasilcek = "True" Then
MsgBox("Data sudah ada , silahkan cek data yang akan diinput ")
Else
Call recording()
End If
Call bersih()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Call edittable()
End Sub
Sub bersih()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Call hapusrecord()
End Sub
Sub edittable()
tgl = DateTimePicker1.Value
If Button2.Text = "Edit" Then
Button2.Text = "Simpan"
Button1.Enabled = "false"
Button3.Enabled = "false"
Button4.Text = "BATAL"
TextBox1.Focus()
Else
If TextBox1.Text = "" Then Exit Sub
If TextBox2.Text = "" Then Exit Sub
If TextBox3.Text = "" Then Exit Sub
Try
Call bukakoneksi()
tampil2.Connection = database
tampil2.CommandType = CommandType.Text
tampil2.CommandText = " Update datamaterial set nama_mat='" & TextBox2.Text & "',Qty='" & TextBox3.Text & "',type= '" & TextBox4.Text & "',tgl='" & DateTimePicker1.Value & "' where kode_sup='" & TextBox1.Text & "'"
tampil2.ExecuteNonQuery()
Call bersih()
TextBox1.Focus()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End If
End Sub
Sub hapusrecord()
If Button3.Text = "HAPUS" Then
TextBox1.Text = " "
Button3.Text = "Ok"
Button1.Enabled = False
Button2.Enabled = False
Button4.Text = "Batal"
TextBox1.Focus()
Else
If TextBox1.Text = "" Then Exit Sub
If TextBox2.Text = "" Then Exit Sub
If TextBox3.Text = "" Then Exit Sub
Try
Call bukakoneksi()
tampil2.Connection = database
tampil2.CommandType = CommandType.Text
tampil2.CommandText = " Delete from datamaterial where kode_mat='" & Trim(TextBox1.Text) & "'"
tampil2.ExecuteNonQuery()
Call bersih()
TextBox1.Focus()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If Button4.Text = "Keluar" Then
Me.Close()
Else
Call bersih()
Call normal()
End If
End Sub
Sub normal()
Button1.Text = "Input"
Button1.Enabled = "true"

Button2.Text = "Edit"
Button2.Enabled = "true"

Button3.Text = "Hapus"
Button3.Enabled = "true"

Button4.Text = "Keluar"
Button4.Enabled = "true"
End Sub
Private Sub Data_Material_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Call bersih()
End Sub
End Class

Tidak ada komentar:

Posting Komentar