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!
User contributions licensed under CC BY-SA 3.0