Hi I'm a novice to programming and I'm trying to learn VB.Net and would appreciate a little help.
I'm working on a small project that has a contact database (Access) containing names, address's and a picture as an OLE Image.
I can get all of the text objects on my form with out a problem, however the image is not proving so easy!
Here is the code that I'm using to populate the fields and it is the last line that is giving me problems.
txtFirstName.Text = Ds.Tables("AddressBook").Rows(Inc).Item(1)
txtSurName.Text = Ds.Tables("AddressBook").Rows(Inc).Item(2)
txtAddress1.Text = Ds.Tables("AddressBook").Rows(Inc).Item(3)
txtAddress2.Text = Ds.Tables("AddressBook").Rows(Inc).Item(4)
txtAddress3.Text = Ds.Tables("AddressBook").Rows(Inc).Item(5)
txtPostCode.Text = Ds.Tables("AddressBook").Rows(Inc).Item(6)
txtPhone.Text = Ds.Tables("AddressBook").Rows(Inc).Item(7)
txtEmail.Text = Ds.Tables("AddressBook").Rows(Inc).Item(8)
txtNotes.Text = Ds.Tables("AddressBook").Rows(Inc).Item(9)
bxImage.Image = Ds.Tables("AddressBook").Rows(Inc).Item("image")
When it runs I get an exception saying Invalid Cast.
Could someone please point me in the right direction.
Many thanks,
Noel.
I'm working on a small project that has a contact database (Access) containing names, address's and a picture as an OLE Image.
I can get all of the text objects on my form with out a problem, however the image is not proving so easy!
Here is the code that I'm using to populate the fields and it is the last line that is giving me problems.
txtFirstName.Text = Ds.Tables("AddressBook").Rows(Inc).Item(1)
txtSurName.Text = Ds.Tables("AddressBook").Rows(Inc).Item(2)
txtAddress1.Text = Ds.Tables("AddressBook").Rows(Inc).Item(3)
txtAddress2.Text = Ds.Tables("AddressBook").Rows(Inc).Item(4)
txtAddress3.Text = Ds.Tables("AddressBook").Rows(Inc).Item(5)
txtPostCode.Text = Ds.Tables("AddressBook").Rows(Inc).Item(6)
txtPhone.Text = Ds.Tables("AddressBook").Rows(Inc).Item(7)
txtEmail.Text = Ds.Tables("AddressBook").Rows(Inc).Item(8)
txtNotes.Text = Ds.Tables("AddressBook").Rows(Inc).Item(9)
bxImage.Image = Ds.Tables("AddressBook").Rows(Inc).Item("image")
When it runs I get an exception saying Invalid Cast.
Could someone please point me in the right direction.
Many thanks,
Noel.