Dim imgByte() As Byte = dataset.Tables("Employee").Rows(0)("Picture")
Dim imgstremam As New MemoryStream(imgByte)
PictureBox2.Image = Image.FromStream(imgstremam)
If dataset.Tables("Employee").Rows(0)("Picture") IsNot DBNull.Value Then
Dim imgByte() As Byte = dataset.Tables("Employee").Rows(0)("Picture")
Dim imgstremam As New MemoryStream(imgByte)
PictureBox2.Image = Image.FromStream(imgstremam)
End If
Private Sub BtnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNext.Click
Dim pos As Integer = Me.BindingContext(dataset, "Employee").Position
Dim numRows As Integer = dataset.Tables("Employee").Rows.Count
If (pos = (numRows - 1)) Then
Return
Else
Me.BindingContext(dataset, "Employee").Position += 1
pos += 1
test(pos)
End If
updateStatus()
End Sub
Sub test(ByVal pos As Integer)
If dataset.Tables("Employee").Rows(pos)("Picture") IsNot DBNull.Value Then
Dim imgByte() As Byte = dataset.Tables("Employee").Rows(pos)("Picture")
Dim imgstremam As New MemoryStream(imgByte)
PictureBox2.Image = Image.FromStream(imgstremam)
ElseIf dataset.Tables("Employee").Rows(pos)("Picture") Is DBNull.Value Then
PictureBox2.Image = Nothing
MessageBox.Show("งงมาก")
End If
End Sub
คือว่า ผมทำปุ่ม Next อ่ะครับ ก็ให้ เช็คว่า ถ้าค่า Pos ส่งอะกิวเม้นมา ให้เช็ค If dataset.Tables("Employee").Rows(pos)("Picture") IsNot DBNull.Value Then ถ้า สมมุติ Rows(เป็นค้า 10) ถ้าไม่เป็นค่าว่างก็ให้โชว์