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
Cool! Question: How can I make sure images is shown when using up-down keys in datagridview?
ReplyDeleteRob