Showing posts with label Visual Basic. Show all posts
Showing posts with label Visual Basic. Show all posts

Copy File With VB 6.0

DESCRIPTION : you can easily copy a file * with this application because the application I created to facilitate my copy files, to copy files from different drives makes me dizzy clicking Arm-time ^ _ ^, before I apologize if my language bad Britain and was also assisted by google translate ^ _ ^ please try yourself.

image

Public NamaFile, Tujuan As String

Private Sub CmdCopy_Click()
    If NamaFile = "" Or Tujuan = "" Then
        Beep
        MsgBox "Tidak dapat dicopy, file belum dipilih!", vbQuestion, "Mengcopy File"
        Exit Sub
    End If
    FileCopy NamaFile, Tujuan
    MsgBox "File sudah dicopy dengan sukses!", vbInformation, "Mengcopy File"
End Sub

Private Sub CmdKeluar_Click()
    End
End Sub

Private Sub Drive2_Change()
    Dir2.Path = UCase(Drive2.Drive)
End Sub

Private Sub Dir2_Change()
    Tujuan = Dir2.Path + "\" + File1.FileName
    If Mid$(Tujuan, 4, 1) = "\" Then
        Tujuan = Dir2.Path + File1.FileName
    End If
    Label2.Caption = Tujuan
End Sub

Private Sub Drive1_Change()
    Dir1.Path = UCase(Drive1.Drive)
End Sub

Private Sub Dir1_Change()
    File1.Pattern = "*.*"
    File1.Path = Dir1.Path
End Sub

Private Sub File1_Click()
    NamaFile = Dir1.Path + "\" + File1.FileName
    If Mid$(NamaFile, 4, 1) = "\" Then
        NamaFile = Dir1.Path + File1.FileName
    End If
    Label1.Caption = NamaFile
    Dir2_Change
End Sub

 

DOWNLOAD SOUCE HERE “and help develop their own”

Structure Select Case

 

DESCRIPTION  : food menu sample program below is how the structure of the "select case" is used in Visual Basic 6.0,

image

“Open VB 6.0, Copy paste source code and save project program is runing “

Private Sub Form_Load()
    List1.AddItem "Mie Ayam"
    List1.AddItem "Mie Goreng"
    List1.AddItem "Cumi Goreng"
    List1.AddItem "Tempe"
End Sub

Private Sub Command1_Click()
    Dim Harga As Currency, Total As Currency
    Dim jumlah As Integer
    Dim Diskon As Single
    Dim satuan As String
    If List1.Text = "" Then
        MsgBox "Anda belum memilih barang !!"
        List1.ListIndex = 0
        Exit Sub
    End If
    If Text1.Text = "" Then
        MsgBox "Anda belum mengisi jumlah barang !!"
        Text1.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(Text1.Text) Then
        MsgBox "Isi jumlah barang harus angka !!"
        Text1.SetFocus
        Exit Sub
    End If
    Select Case List1.Text
    Case "Tempe"
        Harga = 35000
        satuan = "Porsi"
    Case "Mie Ayam"
        Harga = 20000
        satuan = "Porsi"
    Case "Mie Goreng"
        Harga = 25000
        satuan = "Porsi"
    Case "Cumi Goreng"
        Harga = 10000
        satuan = "Porsi"
    End Select
    lblBarang.Caption = "Barang : " & List1.Text
    lblHarga.Caption = "Harga : " & Format(Harga, "Currency") & "/" & satuan
    lblJumlah.Caption = "Jumlah : " & Text1.Text & " " & satuan

    jumlah = Text1.Text
    Select Case jumlah
    Case Is < 10
        Diskon = 0
    Case 10 To 20
        Diskon = 0.15
    Case Else
        Diskon = 0.2
    End Select
    Total = jumlah * (Harga * (1 - Diskon))
    lblDiskon.Caption = "Diskon : " & Format(Diskon, "0 %")
    lblTotal.Caption = "Total Bayar : " & Format(Total, "Currency")
End Sub