I am working on a program that will eventually dynamically create tabs to display pdf files, word documents and text files. To start I am just using an OpenFileDialog to point to a pdf to create a tab and open the file. This is working for 1 pdf, with one small issue, I have to click on the PDF control in order for the pdf to display, otherwise its just a grey screen. My bigger problem is when I try to add a second file to the mix. When I click the button again to add another file the code executes until it reaches "PDFFile.LoadFile(strFileN
ame);". At that point I get an error, Exception of type 'System.Windows.Forms.AxHo
n' was thrown. I've tried to find a solution but the one I keep seeing is I need to put in CreateControl(), which I am already doing. Has anyone tried to do anything like this and had success?
TabPage page = new TabPage();
page.Text = strTabName;
AxAcroPDF PDFFile = new AxAcroPDF();
PDFFile.Dock = DockStyle.Fill;
var message = ex.Message.ToString();