5 frmInputNIlai

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

Option Strct On

Imports System.Drawing.Drawing2D
Imports Praktikum.classGlobalVariabel
Imports System

Imports System.DPublic CLass FrmInputNilai

Dim nfi As NumberFormatInfo = New CultureInfo("id-False").NumberFormat


Dim TextP1 As Double
Dim TextP2 As Double
Dim TextQ1 As Double
Dim TextQ2 As Double
Dim TextA As Double
Dim TextB As Double
Dim TextC As Double
Dim TextD As Double
Dim TextL As Double

Private Sub Simpan_Input()


mdlKoneksi.OpenConnectiion()
Dim sql = "insert into InputNilai (Kode,P1,P2,Q1,Q2,A,B,C,D,L)values " &_
"('" & FormUtama.ToolStripStatusKode.Text & "','" & txtP1.Text & "'" &_
",'" & txtP2.Text & "','" & txtQ1.Text & "','" & txtQ2.Text & "'" &_
",'" & txtA.Text & "','" & txtB.Text & "','" & txtC.Text & "'" &_
",'" & txtD.Text & "','" & txtL.Text & "')"

Dim sqlc As OleDbCommand = New OleDbCommand(sql, xConnection)


Dim xDataReader As OleDbDataReader
xDataReader = sqlc.ExecuteReader
xDataReader.Close()
xConnection.Close()

End Sub

Private Sub FrmInputNIlai_Load(ByVal sender As System.Object,ByVal e As


System.EventArgs) Handles MyBase.Load
btnPreview.Enabled = False
btnOK.Enabled = False
nfi.NumberDecimalSeparator = ","
End Sub

Private Sub BtnCancel_Click(ByVal sender As System.Object,ByVal e As System.C)


Handles BtnCancel.Click
Me.Close()
End Sub

Private Sub txtP1_KeyPress(ByVal sender As Object,ByVal e As


System.Windows.Forms.KeyPress) Handles txtP1.KeyPress

if Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso_


Asc(e.KeyChar) <> 44 AndAlso NOt IsNumeric(e.KeyChar) Then
'MessageBox.Show("Input Hanya Berupa Angka !!")
e.Handled = True
End If

End Sub

Private Sub txtP2_KeyPress(ByVal sender As Object,ByVal e As


System.Windows.Forms.KeyPress) Handles txtP2.KeyPress
if Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso_
Asc(e.KeyChar) <> 44 AndAlso NOt IsNumeric(e.KeyChar) Then
'MessageBox.Show("Input Hanya Berupa Angka !!")
e.Handled = True
End If

End Sub

Private Sub txtQ1_KeyPress(ByVal sender As Object,ByVal e As


System.Windows.Forms.KeyPress) Handles txtQ1.KeyPress

if Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso_


Asc(e.KeyChar) <> 44 AndAlso NOt IsNumeric(e.KeyChar) Then
'MessageBox.Show("Input Hanya Berupa Angka !!")
e.Handled = True
End If

End Sub

Private Sub txtQ2_KeyPress(ByVal sender As Object,ByVal e As


System.Windows.Forms.KeyPress) Handles txtQ2.KeyPress

if Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso_


Asc(e.KeyChar) <> 44 AndAlso NOt IsNumeric(e.KeyChar) Then
'MessageBox.Show("Input Hanya Berupa Angka !!")
e.Handled = True
End If

End Sub

Private Sub txtA_KeyPress(ByVal sender As Object,ByVal e As


System.Windows.Forms.KeyPress) Handles txtA.KeyPress

if Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso_


Asc(e.KeyChar) <> 44 AndAlso NOt IsNumeric(e.KeyChar) Then
'MessageBox.Show("Input Hanya Berupa Angka !!")
e.Handled = True
End If

End Sub

Private Sub txtB_KeyPress(ByVal sender As Object,ByVal e As


System.Windows.Forms.KeyPress) Handles txtB.KeyPress

if Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso_


Asc(e.KeyChar) <> 44 AndAlso NOt IsNumeric(e.KeyChar) Then
'MessageBox.Show("Input Hanya Berupa Angka !!")
e.Handled = True
End If

End Sub

Private Sub txtC_KeyPress(ByVal sender As Object,ByVal e As


System.Windows.Forms.KeyPress) Handles txtC.KeyPress

if Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso_


Asc(e.KeyChar) <> 44 AndAlso NOt IsNumeric(e.KeyChar) Then
'MessageBox.Show("Input Hanya Berupa Angka !!")
e.Handled = True
End If

End Sub

Private Sub txtD_KeyPress(ByVal sender As Object,ByVal e As


System.Windows.Forms.KeyPress) Handles txtD.KeyPress

if Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 AndAlso_


Asc(e.KeyChar) <> 44 AndAlso NOt IsNumeric(e.KeyChar) Then
'MessageBox.Show("Input Hanya Berupa Angka !!")
e.Handled = True
End If

End Sub

Private Sub btnOk_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)


Handles btnOk.Click
Simpan_Input()
FormUtama.btnReaksiTumpuan.Enabled = True
Me.Close()
End Sub

Private Sub txtA_TextChanged(ByVal sender As System.Object,ByVal e As


System.EventArgs) Handles txtA.TextChanged
Input_Parse()
txtL.Text = CStr(TextA+TextB+TextC+TextD)
EndSub

Private Sub txtB_TextChanged(ByVal sender As System.Object,ByVal e As


System.EventArgs) Handles txtB.TextChanged
Input_Parse()
txtL.Text = CStr(TextA+TextB+TextC+TextD)
EndSub

Private Sub txtC_TextChanged(ByVal sender As System.Object,ByVal e As


System.EventArgs) Handles txtC.TextChanged
Input_Parse()
txtL.Text = CStr(TextA+TextB+TextC+TextD)
EndSub

Private Sub txtD_TextChanged(ByVal sender As System.Object,ByVal e As


System.EventArgs) Handles txtD.TextChanged
Input_Parse()
txtL.Text = CStr(TextA+TextB+TextC+TextD)
EndSub

Private Sub btnPreview_Click(ByVal sender As System.Object,ByVal e As


System.EventArgs) Handles btnPreview.Click
Input_Parse()
txtL.Text = CStr(TextA+TextB+TextC+TextD)
txtP1.Text = FormatNumber(TextP1, 2)
txtP2.Text = FormatNumber(TextP2, 2)
txtQ1.Text = FormatNumber(TextQ1, 2)
txtQ2.Text = FormatNumber(TextQ2, 2)
txtA.Text = FormatNumber(TextA, 2)
txtB.Text = FormatNumber(TextB, 2)
txtC.Text = FormatNumber(TextC, 2)
txtD.Text = FormatNumber(TextD, 2)
txtL.Text = FormatNumber(TextL, 2)

If CDbl (txtP1.Text) >=100 Or txtP1.Text =" " Then


MessageBox.Show("Input P1 Tidak Boleh Kosong Atau >100 !!)
txtP1.Focus()
ElseIf CDbl (txtP2.Text) >=100 Or txtP2.Text =" " Then
MessageBox.Show("Input P2 Tidak Boleh Kosong Atau >100 !!)
txtP2.Focus()
ElseIf CDbl (txtQ1.Text) >=100 Or txtQ1.Text =" " Then
MessageBox.Show("Input Q1 Tidak Boleh Kosong Atau >100 !!)
txtQ1.Focus()
ElseIf CDbl (txtQ2.Text) >=100 Or txtQ2.Text =" " Then
MessageBox.Show("Input Q2 Tidak Boleh Kosong Atau >100 !!)
txtQ2.Focus()
ElseIf txtA.Enabled = True And txtA.Text =" " Then
MessageBox.Show("Input A Tidak Boleh Kosong !!)
txtA.Focus()
ElseIf txtB.Enabled = True And txtB.Text =" " Then
MessageBox.Show("Input B Tidak Boleh = 0 !!)
txtB.Focus()
ElseIf txtC.Enabled = True And txtC.Text =" " Then
MessageBox.Show("Input C Tidak Boleh Kosong !!)
txtC.Focus()
ElseIf txtD.Enabled = True And txtD.Text =" " Then
MessageBox.Show("Input D Tidak Boleh Kosong !!)
txtD.Focus()
ElseIf CDbl(txtL.Text) >30 Then
MessageBox.Show("Panjang Bentang Tidak Boleh > 30 !!)
Else

Tampil_Model()
btnPreview.Enabled = False
btnOk.Enabled = True
btnOk.Fokus()

End If

End Sub

Private Sub Tampil_Model()

If FormUtama.txtNamaModal.Text = Model1A Then


mdlGambar.Tumpuan_Sendi()
mdlGambar.Tumpuan_Roll()
mdlGambar.Batas_Garis_Jarak_Beban_B()
mdlLabel.Label_Jarak_Beban_B()
mdlBeban.Beban_Titik_1_A()
ElseIf FormUtama.txtNamaModal.Text = Model1B Then
mdlGambar.Tumpuan_Sendi()
mdlGambar.Tumpuan_Roll()
mdlGambar.Batas_Garis_Jarak_Beban_C()
mdlLabel.Label_Jarak_Beban_C()
mdlBeban.Beban_Titik_1_A()
mdlBeban.Beban_Titik_2_B()
ElseIf FormUtama.txtNamaModal.Text = Model1C Then
mdlGambar.Tumpuan_Sendi()
mdlGambar.Tumpuan_Roll()
mdlGambar.Batas_Garis_Jarak_Beban_C()
mdlLabel.Label_Jarak_Beban_C()
mdlBeban.Beban_Titik_1_A()
mdlBeban.Beban_Merata_BC()
'ElseIf FormUtama.txtNamaModal.Text = Model1D Then
'ElseIf FormUtama.txtNamaModal.Text = Model1E Then
'ElseIf FormUtama.txtNamaModal.Text = Model1F Then

ElseIf FormUtama.txtNamaModal.Text = Model2A Then


mdlGambar.Tumpuan_Sendi()
mdlGambar.Tumpuan_Roll_A()
mdlGambar.Batas_Garis_Jarak_Beban_B()
mdlLabel.Label_Jarak_Beban_B()
mdlBeban.Beban_Titik_1_B()
mdlBeban.Beban_Merata_0A()
ElseIf FormUtama.txtNamaModal.Text = Model2B Then
mdlGambar.Tumpuan_Sendi()
mdlGambar.Tumpuan_Roll_B()
mdlGambar.Batas_Garis_Jarak_Beban_C()
mdlLabel.Label_Jarak_Beban_C()
mdlBeban.Beban_Titik_1_A()
mdlBeban.Beban_Merata_BC()
ElseIf FormUtama.txtNamaModal.Text = Model2C Then
mdlGambar.Tumpuan_Sendi()
mdlGambar.Tumpuan_Roll_B()
mdlGambar.Batas_Garis_Jarak_Beban_C()
mdlLabel.Label_Jarak_Beban_C()
mdlBeban.Beban_Merata_0B()
mdlBeban.Beban_Titik_1_A()
mdlBeban.Beban_Titik_1_C()
'ElseIf FormUtama.txtNamaModal.Text = Model2D Then
'ElseIf FormUtama.txtNamaModal.Text = Model2E Then
'ElseIf FormUtama.txtNamaModal.Text = Model2F Then

ElseIf FormUtama.txtNamaModal.Text = Model3A Then


mdlGambar.Tumpuan_Sendi_A()
mdlGambar.Tumpuan_Roll_C()
mdlGambar.Batas_Garis_Jarak_Beban_D()
mdlLabel.Label_Jarak_Beban_D()
mdlBeban.Beban_Titik_1_0()
mdlBeban.Beban_Merata_BD()
ElseIf FormUtama.txtNamaModal.Text = Model3B Then
mdlGambar.Tumpuan_Sendi_A()
mdlGambar.Tumpuan_Roll_C()
mdlGambar.Batas_Garis_Jarak_Beban_D()
mdlLabel.Label_Jarak_Beban_D()
mdlBeban.Beban_Titik_1_B()
mdlBeban.Beban_Titik_2_D()
mdlBeban.Beban_Merata_0A()
ElseIf FormUtama.txtNamaModal.Text = Model3C Then
mdlGambar.Tumpuan_Sendi_A()
mdlGambar.Tumpuan_Roll_B()
mdlGambar.Batas_Garis_Jarak_Beban_C()
mdlLabel.Label_Jarak_Beban_C()
mdlBeban.Beban_Titik_1_0()
mdlBeban.Beban_Titik_2_C()
mdlBeban.Beban_Segitiga_AB()
'ElseIf FormUtama.txtNamaModal.Text = Model3D Then

ElseIf FormUtama.txtNamaModal.Text = Model4A Then


mdlGambar.Jepit()
mdlGambar.Batas_Garis_Jarak_Beban_B()
mdlLabel.Label_Jarak_Beban_B()
mdlBeban.Beban_Titik_1_A()
mdlBeban.Beban_Titik_2_B()
ElseIf FormUtama.txtNamaModal.Text = Model4B Then
mdlGambar.Jepit()
mdlGambar.Batas_Garis_Jarak_Beban_A()
mdlLabel.Label_Jarak_Beban_A()
mdlBeban.Beban_Segitiga_A0()
ElseIf FormUtama.txtNamaModal.Text = Model4C Then
mdlGambar.Jepit()
mdlGambar.Batas_Garis_Jarak_Beban_A()
mdlLabel.Label_Jarak_Beban_A()
mdlBeban.Beban_Merata_0a()
'ElseIf FormUtama.txtNamaModal.Text = Model4D Then

End If

mdlGambar.Garis_Bentang()
mdlGambar.Garis_Jarak_Beban()
mdlGambar.Garis_Panjang_Bentang()
mdlGambar.Batas_Garis_Panjang_Bentang()
mdlLabel.Label_Panjang_Bentang()

End Sub

Pivate Sub Input_Parse()

nfi.NumberDecimalSeparator=","
Double.TryParse(txyP1.Text, TextP1)
Double.TryParse(txyP2.Text, TextP2)
Double.TryParse(txyQ1.Text, TextQ1)
Double.TryParse(txyQ2.Text, TextQ2)
Double.TryParse(txyA.Text, TextA)
Double.TryParse(txyB.Text, TextB)
Double.TryParse(txyC.Text, TextC)
Double.TryParse(txyD.Text, TextD)
Double.TryParse(txyL.Text, TextL)

Private Sub txtP1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)


Handles txtP1.Click
txtP1.Text = ""
End Sub

Private Sub txtP2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)


Handles txtP2.Click
txtP2.Text = ""
End Sub

Private Sub txtQ1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)


Handles txtQ1.Click
txtQ1.Text = ""
End Sub

Private Sub txtQ2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)


Handles txtQ2.Click
txtQ2.Text = ""
End Sub
Private Sub txtA_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)
Handles txtA.Click
txtA.Text = ""
End Sub

Private Sub txtB_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)


Handles txtB.Click
txtB.Text = ""
End Sub

Private Sub txtC_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)


Handles txtC.Click
txtC.Text = ""
End Sub

Private Sub txtD_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)


Handles txtD.Click
txtD.Text = ""
End Sub

Private Sub txtL_TextChanged(ByVal sender As System.Object,ByVal e As


System.EventArgs) Handles txtL.TextChanged
btnPreview.Enabled = True
End Sub

End Class()

You might also like