Programming for Everybody: Video connect access database
Showing posts with label Video connect access database. Show all posts
Showing posts with label Video connect access database. Show all posts

Create a Application to connect access database with C# - Complete Course

 


Contents:

Add controls to your form 00:00 Delete last blank row in datagridview 09:26 Browse button 09:42 Create table database 14:21 Add Dataset and relate it with controls 15:37 change columns header text datagridview 20:52 New button 23:16 Format DateTime column in a DataGridView 25:04 Save or update button 26:17 Search button 29:34 Reset button 32:26 Remove button 33:24 Previous button 34:16 Next button 34:48 First button 35:06 Last button 35:25 Close button 35:41

Programming VB.net: Video connect access database with datagridview, image, music and video( source code)

 




Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        OpenFileDialog1.Filter = "Image|*.png;*.jpg;*.bmp"

        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

            TextBox2.Text = OpenFileDialog1.FileName

            PictureBox1.Image = Image.FromFile(TextBox2.Text)

        End If

    End Sub


    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        OpenFileDialog1.Filter = "Voice|*.mp3;*.wma;*.Mp4"

        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

            TextBox3.Text = OpenFileDialog1.FileName

            AxWindowsMediaPlayer1.URL = TextBox3.Text

        End If

    End Sub


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        'TODO: This line of code loads data into the 'DictionaryDataSet.Table1' table. You can move, or remove it, as needed.

        Me.Table1TableAdapter.Fill(Me.DictionaryDataSet.Table1)


    End Sub


    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        Table1BindingSource.AddNew()

        PictureBox1.Image = Nothing

        AxWindowsMediaPlayer1.currentPlaylist.clear()

    End Sub


    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click

        Table1BindingSource.EndEdit()

        Table1TableAdapter.Update(DictionaryDataSet)

        Me.Table1TableAdapter.Fill(Me.DictionaryDataSet.Table1)

    End Sub


    Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(2).Value.ToString)) Then

            PictureBox1.Image = Nothing

        Else

            PictureBox1.Image = Image.FromFile(DataGridView1.CurrentRow.Cells(2).Value.ToString)

        End If

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(3).Value.ToString)) Then

            AxWindowsMediaPlayer1.currentPlaylist.clear()

        Else

            AxWindowsMediaPlayer1.URL = DataGridView1.CurrentRow.Cells(3).Value.ToString

        End If

    End Sub


    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click

        Table1TableAdapter.Search(DictionaryDataSet.Table1, TextBox1.Text)


    End Sub


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

        Table1BindingSource.RemoveCurrent()

        Table1TableAdapter.Update(DictionaryDataSet)

        PictureBox1.Image = Nothing

        AxWindowsMediaPlayer1.currentPlaylist.clear()

    End Sub


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

        Table1BindingSource.MovePrevious()

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(2).Value.ToString)) Then

            PictureBox1.Image = Nothing

        Else

            PictureBox1.Image = Image.FromFile(DataGridView1.CurrentRow.Cells(2).Value.ToString)

        End If

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(3).Value.ToString)) Then

            AxWindowsMediaPlayer1.currentPlaylist.clear()

        Else

            AxWindowsMediaPlayer1.URL = DataGridView1.CurrentRow.Cells(3).Value.ToString

        End If


    End Sub


    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click

        Table1BindingSource.MoveNext()

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(2).Value.ToString)) Then

            PictureBox1.Image = Nothing

        Else

            PictureBox1.Image = Image.FromFile(DataGridView1.CurrentRow.Cells(2).Value.ToString)

        End If

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(3).Value.ToString)) Then

            AxWindowsMediaPlayer1.currentPlaylist.clear()

        Else

            AxWindowsMediaPlayer1.URL = DataGridView1.CurrentRow.Cells(3).Value.ToString

        End If


    End Sub


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

        Table1BindingSource.MoveFirst()

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(2).Value.ToString)) Then

            PictureBox1.Image = Nothing

        Else

            PictureBox1.Image = Image.FromFile(DataGridView1.CurrentRow.Cells(2).Value.ToString)

        End If

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(3).Value.ToString)) Then

            AxWindowsMediaPlayer1.currentPlaylist.clear()

        Else

            AxWindowsMediaPlayer1.URL = DataGridView1.CurrentRow.Cells(3).Value.ToString

        End If

    End Sub


    Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click

        Table1BindingSource.MoveLast()

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(2).Value.ToString)) Then

            PictureBox1.Image = Nothing

        Else

            PictureBox1.Image = Image.FromFile(DataGridView1.CurrentRow.Cells(2).Value.ToString)

        End If

        If (String.IsNullOrEmpty(DataGridView1.CurrentRow.Cells(3).Value.ToString)) Then

            AxWindowsMediaPlayer1.currentPlaylist.clear()

        Else

            AxWindowsMediaPlayer1.URL = DataGridView1.CurrentRow.Cells(3).Value.ToString

        End If

    End Sub


    Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click

        Close()

    End Sub

End Class