HResult=0x80070057 Error happen when I announce string

-1
    public OpenFileDialog ofd = new OpenFileDialog();
    string tmpdata = "inputdata.txt";

    public void button1_Click(object sender, EventArgs e)
    {
        ofd.InitialDirectory = "c:\\";
        ofd.Filter = "exe files (*.exe)|*.exe";
        ofd.Multiselect = true;
        ofd.RestoreDirectory = true;

        if (ofd.ShowDialog() == DialogResult.OK)
        {
            listBox1.Items.Clear();
            string tmp = Path.GetDirectoryName(listBox2.GetItemText(listBox2)) + "\\" + tmpdata;
            File.WriteAllText(tmp, "");

listbox2 has filename which i get from openfiledialog. like C:\Program Files (x86)\Microsoft\file.exe

when i debug this code error, happen in string tmp part.

System.ArgumentException HResult=0x80070057

Can anyone explain why error is happening?

Any help will be appreciated!

c#
asked on Stack Overflow Sep 10, 2018 by Kangmin Park • edited Sep 10, 2018 by stuartd

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0