Welcome

Anti Essays offers essay examples to help students with their essay writing.

Sign Up

Visual Basic Essay

Open Document

Below is an essay on "Visual Basic" from Anti Essays, your source for research papers, essays, and term paper examples.

Public Class Assignment3

    Private lastPrinted As Integer
    Private movies() As String = New String() { _
        "A Dependent's Pay", _
        "An American Resident", _
        "Dancing With Fools", _
        "Home By Yourself", _
        "Ghost Man"}

    Private Sub Assignment3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cboMovies.Items.AddRange(movies)
        dlgPrint.Document = New System.Drawing.Printing.PrintDocument()
        AddHandler dlgPrint.Document.PrintPage, AddressOf PrintReport
    End Sub

    Private Sub Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click, mnuAdd.Click
        If (txtNewMovie.Text = "") Then
            MsgBox("Please enter a movie name to add")
            Exit Sub
        End If

        If (movies.Contains(txtNewMovie.Text)) Then
            MsgBox("Movie already exists. Please enter another movie")
            txtNewMovie.Focus()
            txtNewMovie.SelectAll()
            Exit Sub
        End If

        Array.Resize(movies, movies.Length + 1)
        movies(movies.Length - 1) = txtNewMovie.Text
        cboMovies.Items.Add(txtNewMovie.Text)
        txtNewMovie.Text = ""
        txtNewMovie.Focus()
    End Sub

    Private Sub Remove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRemove.Click, mnuRemove.Click
        If cboMovies.SelectedIndex = -1 Then
            MsgBox("Please select a movie to remove")
            Exit Sub
        End If

        Dim tmp(movies.Length - 1) As String
        Dim i As Integer = 0
        For Each movie As String In movies
            If Not movie = cboMovies.SelectedItem.ToString() Then
                movies(i) = movie
                i += 1
            End If
        Next
        Array.Resize(movies, movies.Length - 1)
        'movies = tmp
        cboMovies.Items.Clear()...

Show More


Citations

MLA Citation

"Visual Basic". Anti Essays. 15 Dec. 2018

<http://snehaedu.com/free-essays/Visual-Basic-63511.html>

APA Citation

Visual Basic. Anti Essays. Retrieved December 15, 2018, from the World Wide Web: http://snehaedu.com/free-essays/Visual-Basic-63511.html