Hi everyone!
I'm trying to display the logo for a particular supplier but I always end up with an error picture.
here's my code:
Imports System.Data.OleDb
Imports System.Data
Public Class SupplierDetails
Dim objConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Cristy\Desktop\InventorySystem\InventorySystem\inventory.mdb")
Dim objDataAdapter As New OleDbDataAdapter( _
"SELECT Supplier, ContactPerson, PhoneNumber, FaxNumber, " & _
"Email, Website, Address, LogoPath " & _
"FROM SupplierDetails " & _
"ORDER BY Supplier", objConnection)
Dim objDataSet As DataSet
Dim objDataView As DataView
Dim objCurrencyManager As CurrencyManager
Private Sub FillDataSetAndView()
objDataSet = New DataSet()
objDataAdapter.Fill(objDataSet, "SupplierDetails")
objDataView = New DataView(objDataSet.Tables("SupplierDetails"))
objCurrencyManager = CType(Me.BindingContext(objDataView), CurrencyManager)
End Sub
Private Sub BindFields()
'clear any previous bindings...
lblSupplier.DataBindings.Clear()
lblContactPerson.DataBindings.Clear()
lblContactNumber.DataBindings.Clear()
lblFaxNumber.DataBindings.Clear()
lblWebsite.DataBindings.Clear()
lblEmail.DataBindings.Clear()
lblAddress.DataBindings.Clear()
CompanyLogo.DataBindings.Clear()
'Add new bindings to the DataView object...
lblSupplier.DataBindings.Add("Text", objDataView, "Supplier")
lblContactPerson.DataBindings.Add("Text", objDataView, "ContactPerson")
lblContactNumber.DataBindings.Add("Text", objDataView, "PhoneNumber")
lblFaxNumber.DataBindings.Add("Text", objDataView, "FaxNumber")
lblWebsite.DataBindings.Add("Text", objDataView, "Website")
lblEmail.DataBindings.Add("Text", objDataView, "Email")
lblAddress.DataBindings.Add("Text", objDataView, "Address")
CompanyLogo.ImageLocation = CStr(objDataSet.Tables(0).Rows(0)("LogoPath"))
'Display a ready status...
TS.Text = "Ready"
End Sub
Private Sub ShowPosition()
'Display the current position and the number of recors
txtRecordPosition.Text = objCurrencyManager.Position + 1 & _
" of " & objCurrencyManager.Count()
End Sub
Private Sub SupplierDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FillDataSetAndView()
BindFields()
ShowPosition()
End Sub
I tried checking if the path that is on my db is correct and it is. So most probably my code is the one at fault
CompanyLogo.ImageLocation = CStr(objDataSet.Tables(0).Rows(0)("LogoPath"))
Its probably this one, I'm not sure how to do this properly can someone help me pls?