Results 1 to 7 of 7

Thread: [RESOLVED] Dock .exe in panel

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    36

    Resolved [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!

  2. #2
    Addicted Member
    Join Date
    Jan 2013
    Posts
    177

    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.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    36

    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!!

  4. #4
    Addicted Member
    Join Date
    Jan 2013
    Posts
    177

    Re: Dock .exe in panel

    Quote Originally Posted by Samurai X View Post
    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.

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    36

    Smile Re: Dock .exe in panel

    Thanks again,

    I will read over the links today and see how i get on!

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    36

    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!!!

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2012
    Posts
    36

    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
  •  



Click Here to Expand Forum to Full Width