I try to open a document in PDF format from ListBox
with C #. I manage to load the documents that are in the file but it is not displayed in axAcroPDF1
, what I want is to be able to load all the files to this ListBox
and be able to select the one that I want and that is shown to me in axAcroPDF1
. Thanks in advance !!!
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog FBD = new FolderBrowserDialog();
if (FBD.ShowDialog() == DialogResult.OK)
{
FileName.Items.Clear();
string[] files = Directory.GetFiles(FBD.SelectedPath);
string[] dirs = Directory.GetDirectories(FBD.SelectedPath);
foreach (string file in files)
{
FileName.Items.Add(Path.GetFileName(file));
}
foreach (string dir in dirs)
{
FileName.Items.Add(Path.GetFileName((dir)));
}
}
}
private void FileName_SelectedIndexChanged(object sender, EventArgs e)
{
FileInfo file = (FileInfo)FileName.SelectedItem;
Process.Start(file.FullName);
}
private void axAcroPDF1_Enter(object sender, EventArgs e)
{
}
}