Senin, 20 Oktober 2014

Contoh soal tugas visual basic 2008

Tugas



Public Class home

    Dim vada As String
    Dim myProses As New Process()
    Dim intPic As Integer
    Dim rand As New Random
    Dim a As Integer






    Private Sub ShutdownToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShutdownToolStripMenuItem.Click
        System.Diagnostics.Process.Start("shutdown", "-s -t 00")
    End Sub

    Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick

    End Sub

    Private Sub LockWondowsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Lock_Windows.ShowDialog()

    End Sub


    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

        Me.WindowState = FormWindowState.Minimized
        Me.ShowInTaskbar = False
        NotifyIcon1.Text = "GAK NGGENAH"
        NotifyIcon1.ContextMenuStrip = ContextMenuStrip1
    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MkDir("D:\dokumen\VB\MID Visual Basic\Eko Wijianto")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        RmDir("D:\dokumen\VB\MID Visual Basic\Haruka")
    End Sub

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

    End Sub

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

    End Sub

  
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim s As String
        Dim i As Integer
        Dim indr As IO.DriveInfo



        For Each indr In IO.DriveInfo.GetDrives
            If indr.DriveType = _
                IO.DriveType.Removable And _
                                indr.IsReady Then
                s = indr.Name
            End If
        Next
        s = Replace(s, ":\", "")



        If vada <> s Then
            'pemasangan
            For i = 1 To Len(s)
                If InStr(vada, Mid(s, i, 1)) = 0 Then
                    Label1.Text = _
                    "Status = Drive " & Mid(s, i, 1) & ":\" & " (terpasang)"
                End If
            Next
            'pencabutan
            For i = 1 To Len(vada)
                If InStr(s, Mid(vada, i, 1)) = 0 Then
                    Label1.Text = _
                    "Status = Drive " & Mid(vada, i, 1) & ":\" & "(telah dicabut)"
                End If
            Next
            vada = s
        End If


    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        End

    End Sub

   
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Lock_Windows.ShowDialog()

    End Sub

    Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter

    End Sub

    Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        myProses.StartInfo.FileName = "AIMP3.exe"
        myProses.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        myProses.Start()
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click

        myProses.StartInfo.FileName = "explorer.exe"
        myProses.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        myProses.Start()



    End Sub



    Private Sub Button7_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        myProses.StartInfo.FileName = "mpc-hc.exe"
        myProses.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        myProses.Start()
    End Sub

    Private Sub home_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        a = 0
    End Sub


    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Button9.Enabled = True
        Timer3.Enabled = True

       

    End Sub

   

    Private Sub Timer3_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
        intPic = rand.Next(0, ImageList1.Images.Count)
        PictureBox4.Image = ImageList1.Images(intPic)


    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        Timer3.Enabled = False

       
    End Sub


   
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click

        myProses.StartInfo.FileName = "explorer.exe"
        myProses.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        myProses.Start()

    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        End

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        lock_mouse_keyboard.ShowDialog()

    End Sub

  
    Private Sub ContextMenuStrip1_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening

    End Sub

    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk

    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        OpenFileDialog1.OpenFile()

        OpenFileDialog1.ShowDialog()
    End Sub

End Class

Tidak ada komentar:

Posting Komentar