我只想根据datagridview中显示或填写PictureBox1的所选行显示图像,当点击另一行时,另一个图像将根据插入其他注册所有者的图像填充框.MySql是我的数据库
这是我的代码
Private Sub DataGridView1_CellMouseClick(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) _
Handles DataGridView1.CellMouseClick
cmd = New MySqlCommand("select ownpic from owners", con)
Dim imageData As Byte() = DirectCast(cmd.ExecuteScalar(), Byte())
If Not imageData Is Nothing Then
Using ms As New MemoryStream(imageData, 0, imageData.Length)
ms.Write(imageData, 0, imageData.Length)
PictureBox1.BackgroundImage = Image.FromStream(ms, True)
End Using
End If
End Sub
谢谢..