I have a screen called Category Master that loads a Category, a Category Description, and an image related to that category.
So far I can load the Category and its description from the database, and databind them together, so that changing the category changes the related description.
I also want to be able to databind the BLOB image which is also stored in the database.
I have the subroutine to load a blob image, but am just not too sure how to bind that to the Category and Description.
Databinding Code
______________
cboCategoryCode.DataSource = dsCategory.Tables _("tblCategoryMaster")
cboCategoryCode.DisplayMember = "CatCode"
txtDescription.DataBindings.Add("Text", dsCategory.Tables _("tblCategoryMaster"), "Description")
Image Retrieval Code
_________________
Public Sub LoadImage()
Dim c As Integer = dsCategory.Tables _ ("tblCategoryMaster").Rows.Count
If c > 0 Then
Dim bytBLOBData() As Byte = _
dsCategory.Tables("tblCategoryMaster").Rows(c - 1)("Image")
Dim stmBLOBData As New MemoryStream(bytBLOBData)
pbxCategory.Image = Image.FromStream(stmBLOBData)
End If
End Sub
So far I can load the Category and its description from the database, and databind them together, so that changing the category changes the related description.
I also want to be able to databind the BLOB image which is also stored in the database.
I have the subroutine to load a blob image, but am just not too sure how to bind that to the Category and Description.
Databinding Code
______________
cboCategoryCode.DataSource = dsCategory.Tables _("tblCategoryMaster")
cboCategoryCode.DisplayMember = "CatCode"
txtDescription.DataBindings.Add("Text", dsCategory.Tables _("tblCategoryMaster"), "Description")
Image Retrieval Code
_________________
Public Sub LoadImage()
Dim c As Integer = dsCategory.Tables _ ("tblCategoryMaster").Rows.Count
If c > 0 Then
Dim bytBLOBData() As Byte = _
dsCategory.Tables("tblCategoryMaster").Rows(c - 1)("Image")
Dim stmBLOBData As New MemoryStream(bytBLOBData)
pbxCategory.Image = Image.FromStream(stmBLOBData)
End If
End Sub