By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,892 Members | 1,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,892 IT Pros & Developers. It's quick & easy.

Memorystream

P: n/a
my code :

MemoryStream AStream = new MemoryStream();
byte[] AImage = null;

try
{
picTreeview.Image.Save(AStream, System.Drawing.Imaging.ImageFormat.Icon);
AImage = AStream.GetBuffer();
AStream.Close();
}
catch (Exception Erro)
{
MessageBox.Show(Erro.Message);
return;
}

Generate a exception :

"Value cannot be null. Parameter name: encoder"
What is wrong ?

Rogerio

Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You don't have an ImageEncoder for ImageType.Icon. If what you're doing is a
seldom done task or a manual task you can try saving it as a bitmap and
copying the bitmap into an Icon file in Visual Studio.

Hope that helps,

DalePres
MCAD, MCDBA, MCSE

"Rogerio Jun" wrote:
my code :

MemoryStream AStream = new MemoryStream();
byte[] AImage = null;

try
{
picTreeview.Image.Save(AStream, System.Drawing.Imaging.ImageFormat.Icon);
AImage = AStream.GetBuffer();
AStream.Close();
}
catch (Exception Erro)
{
MessageBox.Show(Erro.Message);
return;
}

Generate a exception :

"Value cannot be null. Parameter name: encoder"
What is wrong ?

Rogerio

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.