By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,543 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,543 IT Pros & Developers. It's quick & easy.

Viewing Word Docs in Tabs

P: n/a
First of all i am pretty new to VB .NET as a whole so my answer may be
silly as may my questions.
Here is what i would like to do. I would like to open potentially
multiple word documents for viewing only in a tab control. Each Word
document should open in its own tab. Sometimes there may be only 1
document to open, sometimes there may be 5.
I have gotten my app to create the necessary tabs but I can't get more
than one word document to open utilizing the Web Browser object. I am
using an arraylist to store the documents i need to open. If multiple
exist it will open the first one in the first tab, but errors out
stating "Exception of type InvalidActiveXStateException was thrown."
when trying to open the second word doc in the secon tab. Any
suggestions on if this is possible or another way of doing it? Here is
my code:
Try
Dim i As Integer = 0
Dim tbTestTab As TabPage
Do While i < aryTest.Count
tbTestTab = New TabPage
TabControl1.Controls.Add(tbTestTab)
tbTestTab.Name = "tbTab" & i
tbTestTab.Text = "Tab " & i
Dim browser As New AxSHDocVw.AxWebBrowser
browser.Size = New System.Drawing.Size(400, 350)
tbTestTab.Controls.Add(browser)
browser.Navigate2(aryTest(i))
i = i + 1
Loop
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Thanks for the assistance and please let me know if there is something
i should be doing differently as this stuff is new to me. Thanks.

Mar 30 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Aolson,

Not that I have the answer (I never used a worddocument in the webbrowser),
but because that you are using version 2003 code and tell that you are new.

Are you using version 2003 or version 2005?

Cor
Mar 31 '06 #2

P: n/a
I am using 2003.

Mar 31 '06 #3

P: n/a
Aolson,

Did you try this already with the designer. Because of the RESX does it give
in my expirience other results than in code. (In this case it is not a
control it is only an interop to an internal webbrowser)

I mean creating the tabpages and than dragging them upon that one by one.

I am not the only one who had in this case better expiriences with the
designer.

I hope this helps,

Cor
Mar 31 '06 #4

P: n/a
Unfortunately I can't do it this way as sometimes I will have 4 word
docs to open and other times it may only be one. This being the case i
need to programmatically generate the tabs and the browser control
don't i?

Mar 31 '06 #5

P: n/a
> Unfortunately I can't do it this way as sometimes I will have 4 word
docs to open and other times it may only be one. This being the case i
need to programmatically generate the tabs and the browser control
don't i?


Why?

Cor
Mar 31 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.