none
Parameter is not valid - Bitmap bmp = New Bitmap()

    Question

  • I have a grass image located here in my directory. I want to just create a Bitmap, but I am getting an error. (Parameter is not valid.)
    Immediate Window:

    A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll


    Why is this?

    http://img717.imageshack.us/img717/2981/31108071.png

            private void Form1_Load(object sender, EventArgs e)
            {
                Bitmap bmp = new Bitmap("grass.jpg");
            }


    bertino
    Wednesday, February 10, 2010 3:25 PM

Answers

  • You have 2 possibilities

    1. provide the complete filename
    or
    2. copy the image to your \bin\debug folder ( for running in the ide )


    Hannes

    If you have got questions about this, just ask.
    Mark the thread as answered if the answer helps you. This helps others who have the same problem !
    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/
    • Proposed as answer by bpell Wednesday, February 10, 2010 3:47 PM
    • Marked as answer by bertino Wednesday, February 10, 2010 3:51 PM
    Wednesday, February 10, 2010 3:42 PM

All replies