Tugas VB
Sederhana saja.Inti dari program ini kita akan menampilkan Kode Barang, Nama Barang , Harga , Qty , Total dan isi yang sudah kita input di TextBox, dengan ketentuan sebagai berikut
Klik Tombol Mulai akan mengosongkan semua Objek Textbox
Klik Tombol Simpan akan menyimpan hasil Input dari Textbox
Total Otomatis (Output) formula
Total=Harga * Qty
Klik Selesai akan keluar dari Modus Start /Run
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox1.Focus()
On Error GoTo TakAdaFile
Dim Var4 As Object
Dim Var3 As Object
Dim Var2 As Object
Dim Var1 As Object
Dim noFile As Short
noFile = FreeFile()
FileOpen(noFile, "F:\Tugas.CSV", OpenMode.Input)
Do While Not EOF(noFile) ' Loop until end of file.
Input(noFile, Var1)
Input(noFile, Var2)
Input(noFile, Var3)
Input(noFile, Var4)
ListBox1.Items.Add(Var1 & "--" & Var2 & "--" & Var3 & "--" & Var4)
Loop
FileClose(noFile)
Exit Sub
TakAdaFile:
MsgBox("File Tidak ada")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim var5 As Object
Dim Var4 As Object
Dim Var3 As Object
Dim Var2 As Object
Dim Var1 As Object
Dim noFile As Short
noFile = FreeFile()
FileOpen(noFile, "F:\Tugas.csv", OpenMode.Append)
Var1 = TextBox1.Text
Var2 = TextBox2.Text
Var3 = TextBox3.Text
Var4 = TextBox4.Text
var5 = TextBox5.Text
ListBox1.Items.Add(Var1 & "-----" & Var2 & "-----" & Var3 & "----" & Var4 & "-----" & var5)
WriteLine(1, Var1, Var2, Var3, Var4, var5)
FileClose(1)
End Sub
Private Sub TextBox4_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles TextBox4.TextChanged
If Not Len(TextBox4.Text) = 0 Then
TextBox5.Text = CStr(CDbl(TextBox3.Text) * CDbl(TextBox4.Text))
End If
End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Dim var5 As Object
Dim Var4 As Object
Dim Var3 As Object
Dim Var2 As Object
Dim Var1 As Object
Dim noFile As Short
noFile = FreeFile()
FileOpen(noFile, "F:\Tugas.csv", OpenMode.Input)
Do While Not EOF(noFile)
Input(1, Var1)
Input(1, Var2)
'Input(1, Var3)
'Input(1, Var4)
'Input(1, var5)
ListBox1.Items.Add(Var1 & "-----" & Var2 & "-----" & Var3 & "----" & Var4 & "-----" & var5)
Loop
FileClose(noFile)
End Sub
End Class