C# 使用c和文本框打开pdf文件

C# 使用c和文本框打开pdf文件,c#,pdf,C#,Pdf,我想用C打开一个特定的pdf文件。 它与: private void Button1_Click(object sender, EventArgs e) { string filename = "instructions.pdf"; System.Diagnostics.Process.Start(filename); } 因此: private void button1_Click(object sender, EventArgs e) { OpenFileDia

我想用C打开一个特定的pdf文件。 它与:

private void Button1_Click(object sender, EventArgs e)
{
string filename = "instructions.pdf";
System.Diagnostics.Process.Start(filename);
}
因此:

 private void button1_Click(object sender, EventArgs e)
    {

        OpenFileDialog open = new OpenFileDialog();
        open.Title = "Open";
        open.Filter = "pdf files (*.pdf) |*.pdf;";
        open.InitialDirectory = @"C:\temp";

        try
        {
            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                axAcroPDF1.LoadFile(open.FileName);
            }
        }
        catch (ArgumentException ex)
        {
            MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
private void button1_Click(object sender, EventArgs e)
    {
        string filename = textBox1.Text + ".pdf";
        string path = @"c:\temp\";
        string pathfilename = string.Concat(path,filename);
        System.Diagnostics.Process.Start(pathfilename);
    }
但我想打开一个名为de的pdf文件,文件位于文本框或/和sql表中,如下所示:

private void Button1_Click(object sender, EventArgs e)
    {
    string filename = "TEXTBOX1.pdf";
    System.Diagnostics.Process.Start(filename);
    }
谢谢

解决了这个问题:

 private void button1_Click(object sender, EventArgs e)
    {

        OpenFileDialog open = new OpenFileDialog();
        open.Title = "Open";
        open.Filter = "pdf files (*.pdf) |*.pdf;";
        open.InitialDirectory = @"C:\temp";

        try
        {
            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                axAcroPDF1.LoadFile(open.FileName);
            }
        }
        catch (ArgumentException ex)
        {
            MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
private void button1_Click(object sender, EventArgs e)
    {
        string filename = textBox1.Text + ".pdf";
        string path = @"c:\temp\";
        string pathfilename = string.Concat(path,filename);
        System.Diagnostics.Process.Start(pathfilename);
    }

您是否尝试过使用TextBox的Text属性?