|
-
Apr 29th, 2013, 07:01 AM
#1
Thread Starter
Member
[RESOLVED] Dock .exe in panel
Hello,
I have a list of files displayed in a listbox.
when I select a file from the listbox i want the file to load into a panel on my form.
i.e. if its a word document word will open in the panel, if its a pdf reader wil open into the panel.
I can get the files to load externally using
Code:
Dim ProcStart As New ProcessStartInfo
ProcStart.FileName = ListBox1.SelectedItem
Process.Start(ProcStart)
however i am unsure of how to get it to then dock in my panel. I tried
Code:
Me.Panel1.Controls.Add(ProcStart)
but this is obviously wrong as I can't add a process as a control.
Do i need to create an instance of the program (i.e. word) and then dock that?
thanks for looking!
-
Apr 29th, 2013, 10:28 AM
#2
Addicted Member
Re: Dock .exe in panel
Do you require the user to edit the file as well? Or simply view?
Instead of starting a whole new process, you can simple open the word document in the Webbrowser control. It is capable of handling most text files
Also if you ever need to use word application externally, I would recommended using the com interface available. --> http://support.microsoft.com/kb/316383
Last edited by Crzyrio; Apr 29th, 2013 at 10:33 AM.
-
Apr 29th, 2013, 10:57 AM
#3
Thread Starter
Member
Re: Dock .exe in panel
Hello Crzyrio,
Thanks for replying!
No the user wont be editing the documents just viewing them.
I will take a look at the article that you have attached.
Will it work for other file types such as excel and pdf?
Thanks again!!
-
Apr 29th, 2013, 11:28 AM
#4
Addicted Member
Re: Dock .exe in panel
 Originally Posted by Samurai X
Hello Crzyrio,
Thanks for replying!
No the user wont be editing the documents just viewing them.
I will take a look at the article that you have attached.
Will it work for other file types such as excel and pdf?
Thanks again!!
Yup, it can handle pdf and excel as well.
What ever documents internet explorer can open, the webbrowser will as well.
Take a look at these 2 threads, their question is very similar to yours and they have some code snippets.
http://www.vbforums.com/showthread.p...rowser-control
http://www.vbforums.com/showthread.p...-sheet-problem
EDIT: Msdn link showing you how to open Office documents in webbroswer. --> http://support.microsoft.com/kb/304643/en-us
Sorry for all the links, I am unable to open past projects at the moment.
-
Apr 30th, 2013, 02:18 AM
#5
Thread Starter
Member
Re: Dock .exe in panel
Thanks again,
I will read over the links today and see how i get on!
-
May 7th, 2013, 05:11 AM
#6
Thread Starter
Member
Re: Dock .exe in panel
Hello again!
I have got my web browser working, but it will only display pdf's in the web browser that I have docked to my pannel.
word documents open in word and it says navigation cancelled in the web browser?!
i will have a read through the links you posted again to see if i can find an explanation there!
Thanks again it's near enough doing what i want!!!
-
May 7th, 2013, 05:38 AM
#7
Thread Starter
Member
Re: Dock .exe in panel
It seems that office 2007 and later will not open by default in the web browser,
i found this article that provides a work around!!
http://support.microsoft.com/kb/927009
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|