Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Display bmp in picture box in C#

Posted on 2013-05-19
5
Medium Priority
?
608 Views
Last Modified: 2013-05-20
Hey guys!!

I have a C# application in which I would like to display a signature that is stored in a bmp file.
The signature is in \\CAKPOSSERVER\C\POSiTrack\Sigs.  The file name would be SIG_450566 or some other number matching a transaction number.  I would like to display this signature in a picture box on a form that is opened to show all the information from transaction number 450566 or some other transaction selected in a list or by keying 450566 in a text box and pressing enter.  This would display the transaction form along with the signature.

Thanks guys!!

Jerry
0
Comment
Question by:JDL129
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 39179388
Try something like...
        private void button1_Click(object sender, EventArgs e)
        {
            string folder = @"\\CAKPOSSERVER\C\POSiTrack\Sigs";
            string bmpName = "SIG_" + textBox1.Text + ".bmp";
            string FileName = System.IO.Path.Combine(folder, bmpName);
            if (System.IO.File.Exists(FileName))
            {
                try
                {
                    using (Image img = Image.FromFile(FileName))
                    {
                        pictureBox1.Image = new Bitmap(img);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("File: " + FileName + Environment.NewLine + ex.ToString(), "Error Opening Image");
                }
            }
            else
            {
                MessageBox.Show("File: " + FileName, "File Not Found");
            }
        }

Open in new window

0
 

Author Comment

by:JDL129
ID: 39179785
Idle_Mind!!!!

You're the MAN!!!

thanks,

Jerry
0
 

Author Closing Comment

by:JDL129
ID: 39179786
Excellent!!!
0
 

Author Comment

by:JDL129
ID: 39181809
Idle_Mind!!!

You are awsome!!  I think I should award you more points!!

Thanks again,
Jerry
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 39181830
Uh...no problem.  =)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question