Solved

Display bmp in picture box in C#

Posted on 2013-05-19
5
605 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 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 86

Expert Comment

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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