我需要从员工数据库中读取记录并显示所选项目(不在Gridview中) - 除了存储在varbinary(max)中的图像外,这很好。我需要逐步完成记录 - 前进和后退。有一些记录没有图像。 我在使用每个记录的数据集来理解转换方法时遇到了问题。
我正在使用visual studio 2008和thryng在Windows窗体应用程序中显示记录。
非常感谢帮助。
以下是我的一些代码:
Public Class Form1
Private Sub GraduatesBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GraduatesBindingNavigatorSaveItem.Click
Me.Validate()
Me.GraduatesBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Graduates_DatabaseDataSet)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Graduates_DatabaseDataSet.Graduates' table. You can move, or remove it, as needed.
Me.GraduatesTableAdapter.Fill(Me.Graduates_DatabaseDataSet.Graduates)
End Sub
Private Sub GraduatesBindingNavigator_RefreshItems(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GraduatesBindingNavigator.RefreshItems
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub PhotographLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub SurnameTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SurnameTextBox.TextChanged
End Sub
Private Sub FillBysurnameToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.GraduatesTableAdapter.FillBysurname(Me.Graduates_DatabaseDataSet.Graduates, SsnameToolStripTextBox.Text)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
End Class
答案 0 :(得分:0)
使用PictureBox并为其Image属性分配一个Image对象,该对象是使用Image.FromStream构建的Graduates表中的varbinary(max)字段创建的。
不幸的是,您可以使用没有简单的设计器时间绑定,您将不得不将事件挂钩到数据绑定货币管理器PositionChanged事件。