Solved

Display bmp in picture box in C#

Posted on 2013-05-19
5
596 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
  • 3
  • 2
5 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 250 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 85

Expert Comment

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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Allow users to select all checkboxes 6 60
.NET Error 7 42
Converting C# Objects into JSON file 7 37
Trouble with References... 5 22
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now