views:

178

answers:

1

Hi, I need to read records from a employee database and display selected items (not in Gridview) - this is fine except for the image that is stored in varbinary(max). I need to step through the records - forwards and backwards. There are some records that has not image. I am having problems understanding the convertion method using that dataset for each record.

I am using visual studio 2008 and thryng to display the records in a windows form application.

Help will be greatly appreciated.

Below is some of my code:

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
A: 

Use a PictureBox and assign to its Image property an Image object created from the varbinary(max) field in your Graduates table, built using Image.FromStream.

Unfortunately there is no simple designer time binding you can use, you're going to have to hook an event to your databinding currency manager PositionChanged event.

Remus Rusanu