Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6533859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:10:50+00:00 2026-05-25T10:10:50+00:00

I have images in the database that I want to load asynchronously into a

  • 0

I have images in the database that I want to load asynchronously into a picture box. How would I do this? Right now I have:

byte[] byteBLOBData = new byte[0];
byteBLOBData = (byte[])ds.Tables["magazine_images"].Rows[c - 1]["image"];
MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
pictureBox1.Image = Image.FromStream(stmBLOBData);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
labelMsg.Text = "Picture loaded successfully.";

And I want to do:

pictureBox1.LoadAsync("What should I put here?");

I’m using MySQL database and visual studio 2010 C#

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:10:51+00:00Added an answer on May 25, 2026 at 10:10 am

    Don’t load the bytes into the image, that’ll defeat the purpose of what you’re trying to achieve… (note this is a quick-n-dirty to get the image into a temporary file… there’s a lot of additional considerations here, not the least of which would be to delete the temporary file when you’re done)

    byte[] byteBLOBData = (byte[])ds.Tables["magazine_images"].Rows[c - 1]["image"];
    string tempImageFileName = Path.Combine(Path.GetTempPath(), Path.GetTempFileName() + ".jpg");
    using( FileStream fileStream = new FileStream(tempImageFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite) ) {
        using( BinaryWriter writer = new BinaryWriter(fileStream) ) {
            writer.Write(byteBLOBData);
        }
    }
    
    pictureBox1.LoadCompleted += LoadCompleted;
    pictureBox1.WaitOnLoad = false;
    pictureBox1.LoadAsync(tempImageFileName);
    

    …

    private static void LoadCompleted( object sender, AsyncCompletedEventArgs e ) {
        if( e.Error != null ) {
            // will get this if there's an error loading the file
        } if( e.Cancelled ) {
            // would get this if you have code that calls pictureBox1.CancelAsync()
        } else {
            // picture was loaded successfully
        }
    }
    

    also see the LoadProgressChanged event

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that stores images in a database. Now I have learned
I have these images that I am getting off my server and a database
Basically I have a database with two tables, that is, Updates table and Images
I have fetched images and text as listview from database.now on clicking the particular
I have a controller in MVC serving up images from a database. EDIT: This
I have entered an image in sql server database successfully. Now i want to
We have a requirement that a user can load any standard image into a
I have a database which contains the URL and description of images. I want
I have some images in a SQL Server database. I want to display them
I have a JavaScript slideshow that pre-loads images out of a MySQL database and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.