Загрузка...

OpenFileDialog1

Thread in C# created by Langust_inactive192150 Apr 25, 2019. 164 views

  1. Langust_inactive192150
    Langust_inactive192150 Topic starter Apr 25, 2019 Banned 0 Oct 14, 2017
    OpenFileDialog1 - элемент не существует в данном контексте. Исправляю ошибку эту, так другие ошибки вылазят. Буду очень благодарен кто поможет.


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace WindowsFormsApp1

    {
    public partial class Form1 : Form
    {

    private byte[] encFile;

    private void Button2_Click(object sender, EventArgs e)


    {
    //choose file
    int size = -1;

    DialogResult result = OpenFileDialog1.ShowDialog();
    if (result == DialogResult.OK)
    {
    string file = OpenFileDialog1.FileName;
    try
    {
    byte[] bytes = File.ReadAllBytes(file);
    size = bytes.Length;
    encFile = bytes;
    }
    catch (InvalidOperationException exc)
    {
    MessageBox.Show(exc.ToString());
    }
    }
    }

    public Form1()
    {
    InitializeComponent();
    }
    }
    }
     
  2. Грач
    Грач Apr 25, 2019 Developer 195 May 29, 2016
  3. termicabhf
    termicabhf May 6, 2019 0 Mar 16, 2017
    DialogResult result = OpenFileDialog1.ShowDialog();

    ///
    ///

    OpenFileDialog result = new OpenFileDialog1.ShowDialog();
     
Top
Loading...