I have a Visual C# project where the user opens a file and saves a file, but that's working. I'm on to the EXE part. When I have the openFileDialog vars set, it gives me:

"Argument 3: cannot convert from 'string' to 'System.Security.SecureString'".

I've tried changing var to string and SecureString. Here's my code.

private void button3_Click(object sender, EventArgs e)
{
    if (openFileDialog1.ShowDialog() == DialogResult.OK && saveFileDialog1.ShowDialog() == DialogResult.OK)
    {
        try
        {
            var extract = "e";
            var spmPath = openFileDialog1.FileName;
            var texPath = saveFileDialog1.FileName;
            Process.Start("bin/ptr2spm.exe", extract, spmPath, texPath);
        }
        catch (SecurityException ex)
        {
        MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
        $"Details:\n\n{ex.StackTrace}");
        }
    }
}

0 Answers