CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: how to save image using memory stream and not use savefiledialog

  1. #1
    Join Date
    Dec 2016
    Posts
    13

    how to save image using memory stream and not use savefiledialog

    How to replace save file dialog by using memory stream ?

    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

    Code:
     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 ?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,276

    Re: how to save image using memory stream and not use savefiledialog

    From your code, it looks like that you use the save dialog to prompt the user to retrieve the full file path name and put that into a 'path' variable.

    If you don't want to prompt the user, then set the 'path' variable programmatically. This seems kind of obvious, so maybe I am not understanding your question?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)