Click here to Skip to main content
14,732,921 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I generate qr code for name and country and member

qr code generated without any problem

but i need to use memory stream and not use save file dialog

my code as below

using (SaveFileDialog sv = new SaveFileDialog() { Filter = "JPEG|.jpg", ValidateNames = true })
                    {
                        if (sv.ShowDialog() == DialogResult.OK)
                        {
                            MessagingToolkit.QRCode.Codec.QRCodeEncoder encoder = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
                            encoder.QRCodeScale = 8;
                          
                          
                            string encoding = "UserName : " + textBox4.Text + "\r\n" + "Country : " + comboBox3.Text + "\r\n" + "Membership :" + comboBox5.Text;
                            
                            
                            Bitmap bmp = encoder.Encode(encoding);
                            pictureBox1.Image = bmp;
                            path = sv.FileName;
                            bmp.Save(path, ImageFormat.Jpeg);
                        }

                    }

How to replace save file dialog by using memory stream?

What I have tried:

how to save image using memory stream and not use savefiledialog
Posted
Updated 29-Jan-17 23:58pm
Comments
   
So what is the issue? What did you try?
Richard MacCutchan 30-Jan-17 4:56am
   
SaveFileDialog just allows you to select a file name. So just change your code to enter the file name in some other way.

1 solution

have you tried opening the memorystream as the path

MemoryStream ms = new MemoryStream
...
bmp.Save(ms, ImageFormat.Jpeg);
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900