If someone can help me I will appreciate it. Thanks in advance, I have a combobox with the values databinding inside a database, I want when I move the records next/previous base on what combobox value is a picturebox display a picture I have stored in my resources.
When I change with mouse combobox value the picture change but when I move between records not. What am I missing there?
Private Sub TypeComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TypeComboBox.SelectedIndexChanged
If TypeComboBox.SelectedItem().ToString() = "1" Then
PictureBox1.Image = My.Resources.image1
End if
If TypeComboBox.SelectedItem().ToString() = "2" Then
PictureBox1.Image = My.Resources.image2
End if
End Sub
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
'detect left arrow key
If keyData = Keys.Left Then
If Me.ToolsBindingSource.Position = 0 Then
Me.ToolsBindingSource.MoveLast()
Return True
Else
Me.ToolsBindingSource.MovePrevious()
Return True
End If
End If
'detect right arrow key
If keyData = Keys.Right Then
If Me.ToolsBindingSource.Position = Me.ToolsBindingSource.Count - 1 Then
Me.ToolsBindingSource.MoveFirst()
Return True
Else
Me.ToolsBindingSource.MoveNext()
Return True
End If
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function