473,657 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2944
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_PictureBindin g As Binding
Private currentImageFil e As String

'This binds the pictureBox (picBikePics)
Private Sub BindControls()
m_PictureBindin g = New Binding("Image" , dsAll.Tables
(0), "Filename")
picBikePics.Dat aBindings.Add(m _PictureBinding )
End Sub

'This method gets fired everytime the above Binding
object (m_PictureBindi ng) 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_PictureBindin g_Parse(ByVal sender As Object, ByVal
e As System.Windows. Forms.ConvertEv entArgs) Handles
m_PictureBindin g.Parse

e.Value = currentImageFil e

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_Form at(ByVal sender As Object,
ByVal e As ConvertEventArg s) Handles
m_PictureBindin g.Format

currentImageFil e = 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
2518
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 image property of picturebox to the class. But, when I change the image property of my class, the Image of the picture box doesn't change. Shouldn't this work. I thought that if you bound a control to a data source (Class), that when it changed,...
0
3877
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 your help, Here is the code.
3
63373
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 display (in the status bar) the image coordinates of the mouse location. However, if I use the picturebox's MouseMove event, I am getting the coordinates of the mouse over the PICTUREBOX, not the actual image underneath that (which is stretched)....
3
299
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 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. ...
1
10216
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 to the trouble of creating memorystreams?? I thought there was an easy way in VS 2005 / .Net 2.0
2
2549
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, it doesn't seem to work. It does not display the image from the database (it's blank). Also, when I use a function to upload a new image, it displays correctly but shows regardless of which record I am on. It then does not save to the database...
0
1486
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 these PictureBox.Image setting across application shutdown and subsequent startup. my.Settings is just the ticket, but alas, doing this the only way I find won't work for me because the PictureBox - Application Settings - Property Binding doesn't expose...
4
3810
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 picturebox on the map_picture and the new added picturebox should have click event to get the location of it when it is clicked. i have written some code in C# but when clicking the small picturebox it just gets the location of the last added one,...
5
5375
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 example works. I have tried Show, Enabled, Visible, and even BackColor. Why does a help example not work? and why does Design creation work? Thanks - I hope.
0
8384
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.