Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 19th, 2004, 01:27 AM
Authorized User
Join Date: Nov 2003
Location: Mataro, Barcelona, Spain.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default bindings & images


How must I do to bind a picture with a picture box?

When I tried it, I get an invalid typecast exception.

Binding ImageBinding;
ImageBinding = new Binding("Image", dsRadiografias, "RADIOGRAFIAS.rad_imagen");
//ImageBinding.Format += new ConvertEventHandler(this.PictureFormat);

I was trying with this conversion routine, with no good results:

void PictureFormat(Object sender, ConvertEventArgs e)
      Byte[] img = (Byte[]) e.Value;
      // Perform the conversion
      MemoryStream ms = new MemoryStream();
      int offset = 0; // should be 0
      ms.Write(img, offset, img.Length - offset);
      Bitmap bmp = new Bitmap(ms);

      // Writes the new value back
      e.Value = bmp;

World only exists into your mind.
Reply With Quote
  #2 (permalink)  
Old August 20th, 2004, 01:02 AM
Authorized User
Join Date: Nov 2003
Location: Mataro, Barcelona, Spain.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts

Sorry, there is no problem. I was fighting with another error, but I got confused for the null values when I tried to insert new records.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML File & Images DennyLoi XML 4 November 4th, 2007 12:58 PM
Uploading & retriving Images From Database aaaboye Classic ASP Basics 1 February 20th, 2007 04:03 PM
Dynamic Images & Go To Detail Page malhyp Dreamweaver (all versions) 1 January 27th, 2006 06:10 AM
bindings & date format miguel.ossa C# 12 August 28th, 2004 06:23 AM
Loading Images & Interact with Outlook wasaan SQL Server ASP 1 August 4th, 2003 06:35 PM

All times are GMT -4. The time now is 06:52 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.