Skip to content

OpenFileDialog on a Pocket PC Device

raver

Asked Jun 15, 2006, 6:00 AM EDT1 answer
Share
LinkedInX

I have never worked with C# and I'm having problems with even the simplest tasks.  I have to convert some C code into C# but also while working on a Pocket PC Device.  I noticed that there are a lot of members that are not supported by the Pocket PC platform.  So my question is, what is the C# code to be able to open a file on a Pocket PC?

This is what I have, but I get an error because OpenFile() is not supported by Pocket Pc:

TypeScript
private void butLoad_Click(object sender, EventArgs e)
        {
            Stream myStream;
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.InitialDirectory = "c:\\";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if ((myStream = openFileDialog1.OpenFile()) != null)
                {
                    // Insert code to read the stream here.
                    myStream.Close();
                }
            }

        }

Any help is appreciated.  If anybody knows how to open just a file in an 8-bit grey scale, that would also be helpful.

Thanks

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Well, I got the Pocket PC Device to be able to open a .bmp file with this code:

    private void butLoad_Click(object sender, EventArgs e)
    {
    OpenFileDialog fileDialog = new OpenFileDialog();

    fileDialog.InitialDirectory = "c:\\";
    fileDialog.Filter = "Bitmap Files (*.bmp)|*.bmp";

    if (fileDialog.ShowDialog() == DialogResult.OK)
    {
    // Open the selected image
    System.Drawing.Bitmap image = new System.Drawing.Bitmap(fileDialog.FileName);
    }

    }

    But if anyone knows how to have the device ONLY open 8-bit grey scale images, then that would still be helpful.

    thanks
    0