0

hi, have a slight problem here.

this is my open file dialog code.

private void browseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title = "Browse And Upload A Template.";
            ofd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";

           DialogResult dr = ofd.ShowDialog();

          
            if (dr == DialogResult.OK)
            {
                //bitmap = (Bitmap)Bitmap.FromFile(ofd.FileName);
                //setup(true);
                System.IO.StreamReader sr = new System.IO.StreamReader(filename);

                Form activeChildForm = this.ActiveMdiChild;

               // filename = ofd.FileName;
                pictureBox3.Image = Image.FromFile(ofd.FileName);
                Image imgPhotoVert = Image.FromFile(ofd.FileName);
                Image imgPhotoHoriz = Image.FromFile(ofd.FileName);
                Image imgPhoto = null;
                imgPhoto = FixedSize(imgPhotoVert, 720, 500);
                pictureBox3.Image = imgPhoto;


                if (activeChildForm != null)
                {
                    TextBox activeTextBox = (TextBox)activeChildForm.ActiveControl;

                    if (activeTextBox != null)
                        activeTextBox.Text = sr.ReadToEnd();

                    sr.Close();
                }


                else
                {

                    return;

                }
            }

        }

how am i to read in the file that was opened by the dialog into other functions?

i want to read in the file that i had selected from the open file dialog into this function call ZOOM ;

private void btnZoomOut_Click(object sender, EventArgs e)
        {
            zoomCounter--;
            // ZOOM OUT


     [B]       Image imgPhotoVert = Image.FromFile();
            Image imgPhotoHoriz = Image.FromFile(filename);[/B]

the bold area is the one that has error. PLS help. thank u.

2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by __avd
0

>how am i to read in the file that was opened by the dialog into other functions?

Through the method arguments. Pass a filename or a reference of FileInfo object to that method.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.