473,320 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PictureBox Binding

Hi All,

I've been working on a form that has several bound
controls that all link to one table in a dataset. In the
table, there is a column for the filename of jpeg images
related to each record. I have a combobox which displays
the key for each record so that the user can select an
item and all the other controls update. So far i have
the combobox, a label and a textbox all bound and working
correctly when a user selects an item. I have a
pictureBox on the form however that i wish to be bound to
the filename field for the specific row. Does anybody
know how to do this?

Thanks in advance,
Jesse

ps. I don't want to put a BLOB field in the database for
the images and do it that way.
Jul 21 '05 #1
3 2915
Cor
Hi Jesse,

You have to streamread it to get it in your picturebox (even if you use a
blobfield)

I think that you can not bind real in a productive way.

So in my opinion you only can use the changing events to read it.

But just my thought about it

Cor


I've been working on a form that has several bound
controls that all link to one table in a dataset. In the
table, there is a column for the filename of jpeg images
related to each record. I have a combobox which displays
the key for each record so that the user can select an
item and all the other controls update. So far i have
the combobox, a label and a textbox all bound and working
correctly when a user selects an item. I have a
pictureBox on the form however that i wish to be bound to
the filename field for the specific row. Does anybody
know how to do this?

Thanks in advance,
Jesse

Jul 21 '05 #2
Thanks cor for your suggestions.

I have found a way though which does not involve streams
(because i didn't want to use BLOB fields).

What i have done is this (if you wish to know):

'Members
Private WithEvents m_PictureBinding As Binding
Private currentImageFile As String

'This binds the pictureBox (picBikePics)
Private Sub BindControls()
m_PictureBinding = New Binding("Image", dsAll.Tables
(0), "Filename")
picBikePics.DataBindings.Add(m_PictureBinding)
End Sub

'This method gets fired everytime the above Binding
object (m_PictureBinding) row is changed and is used to
place the correct value back in the database before
continuing. (In my case, i don't want to change the
database field at all so i set it to what it was
originally which i set in the method "Format") Private
Sub m_PictureBinding_Parse(ByVal sender As Object, ByVal
e As System.Windows.Forms.ConvertEventArgs) Handles
m_PictureBinding.Parse

e.Value = currentImageFile

End Sub

'This method gets fired everytime that same object is
changed but is used to make sure the value going into the
control from the database is of the right type for the
Image property on the control. So i have to convert the
filename string to an Image object.
Private Sub PictureBox_Format(ByVal sender As Object,
ByVal e As ConvertEventArgs) Handles
m_PictureBinding.Format

currentImageFile = CStr(e.Value)
e.Value = Image.FromFile(CStr(e.Value))

End Sub

Anyways, thanks again.
Hope u got something out of it. I did.

Jesse

-----Original Message-----
Hi Jesse,

You have to streamread it to get it in your picturebox (even if you use ablobfield)

I think that you can not bind real in a productive way.

So in my opinion you only can use the changing events to read it.
But just my thought about it

Cor


I've been working on a form that has several bound
controls that all link to one table in a dataset. In the table, there is a column for the filename of jpeg images related to each record. I have a combobox which displays the key for each record so that the user can select an
item and all the other controls update. So far i have
the combobox, a label and a textbox all bound and working correctly when a user selects an item. I have a
pictureBox on the form however that i wish to be bound to the filename field for the specific row. Does anybody
know how to do this?

Thanks in advance,
Jesse

.

Jul 21 '05 #3
Cor
Hi Jesse,

Although I never used the event you are using, it was the solution I was
thinking on when I saw your problem. (Not that I would do it that way, but
in the way that you are making your program I would)

(Sometimes I see answers people telling this, and I do not believe that is
true, but you can trust me that is something I do not do).

Cor

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Cade Carvell | last post by:
Hello, I have a class that I have a public property on it for an Image. In my class I change the image, different image etc. Anyway, Everythign works fine for the first image. I an bind the...
0
by: akh | last post by:
I want to use de Drag and Drop ´s event to move a picture box from a form and within a Picture Box. But I have behaviour if the MyPBox As PictureBox as the Globale varible or not Thanks for...
3
by: Tom | last post by:
I have a picturebox on my VB.NET form. The picturebox size mode is set to stretched. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and...
3
by: Jesse | last post by:
Hi All, I've been working on a form that has several bound controls that all link to one table in a dataset. In the table, there is a column for the filename of jpeg images related to each...
1
by: Joe Spears | last post by:
Hi Is there a simple way to bind a PictureBox image to a datatable?? I've tried pictureBox.DataBindings.Add("BackgroundImage", dt1, "Picture"); But it doesn't seem to work. Do I have to go...
2
by: Ryan | last post by:
I have a very basic form that has controls bound to a SQL 2005 database for an Employee Directory. I'm using a PictureBox control to bind to the "Photo" field which is of datatype image. However,...
0
by: dlamar | last post by:
I'm using VB.NET with 2.0 - I have a number of PictureBoxes in my application - all of which use a context menu to change the associated Image to one of 5 options. I need to maintain the state of...
4
by: munibe | last post by:
Hi, i have a problem about picturebox control. if you may help me, i will be so happy. i have a picturebox named pic_map, and i added a button named customer_button, my wish is to add a new small...
5
by: AWW | last post by:
XP VB 2005 running an example from help that creates a picturebox in code - the picturebox is not created. If I comment out the "Dim Box as New PictureBox" and create it in Design mode - the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.