I'm working on a film manager program. The below code works when I have it in the PictureBox's method (I've moved it out to the DataGridView's code as you can see), so that when I click the PictureBox, it loads the current cell's film name and displays its poster image. But now that I got that working, I want to make it so that whenever I move to another row, it changes to load that row's film (the current row). Do you know how I can do this? Do I need a different method or some sort action that initiates this process? Thanks for any assistance you can lend in advance.
Code:
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
End Sub
Private Sub FilmsDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles FilmsDataGridView.CellContentClick
FilmName = FilmsDataGridView.CurrentCell.Value.ToString()
GetYear()
GetDuration()
GetActors()
GetDirectors()
GetWriters()
'Label1.Text = FilmName
Dim URLText As String = RetrieveFilmInfo()
' Retrieves film poster image URL
Dim BeginString As String = URLText.IndexOf("http")
Dim EndString As String = URLText.IndexOf(""",""imdbRating""")
Try
Dim PosterURL As String = URLText.Substring(BeginString, EndString - BeginString)
' Retrieves film poster image
Dim ImageInBytes() As Byte = MyWebClient.DownloadData(PosterURL)
Dim ImageStream As New IO.MemoryStream(ImageInBytes)
PictureBox1.Image = New System.Drawing.Bitmap(ImageStream)
Catch NoInfo As ArgumentOutOfRangeException
MessageBox.Show("No poster image.")
End Try
End Sub