I've satisfactorily got an axwebbrowser control on a form within a
panel, suitably positioned and sized, and now I want to display a
webpage on it. This is not normally a problem when I have the
control as a uniquely named object, since I would just use the
axweb.Navigate or Navigate2 method to send it to the right page.
However, it's part of a controls collection, accessible only via its
place in the collection.
[Form3, the form with the web browser]
Public Sub LoadWebBrowser( )
If WebBrowserExist s = False Then
Dim ax As New AxSHDocVw.AxWeb Browser
ax.Dock = DockStyle.Fill
Me.Controls.Add (ax)
WebBrowserExist s = True
WebBrowserIndex = Me.Controls.Cou nt - 1
End If
End Sub
As you can see, Form3.Controls( WebBrowserIndex ) is the webbrowser
control. Now how do I set the page on the control? Using
ax.Navigate within this procedure gives me the following error
'An unhandled exception of type 'InvalidActiveX StateException'
occurred in systems.windows .forms.dll'
and is not ideal in any case, since I'm not sure if the object ax
will continue to exist outside this procedure. But trying to access
the method via
Me.Controls(Web BrowserIndex).N avigate
doesn't work at all, as Navigate is not a member of
System.Windows. Forms.Control, despite being a member of _that
particular_ control.
Incidentally, if anyone can get Form3 to locate and size
appropriately with an axwebbrowser control inside at designtime then
this will save me a lot of headaches. But I reckon I'll probably
want to access methods of controls in collections sooner or later, so
I'll still be grateful for help in this.
--
Cheers, ymt.
The endless moaner. 2 1576
Yuk Tang wrote: I've satisfactorily got an axwebbrowser control on a form within a panel, suitably positioned and sized, and now I want to display a webpage on it. This is not normally a problem when I have the control as a uniquely named object, since I would just use the axweb.Navigate or Navigate2 method to send it to the right page. However, it's part of a controls collection, accessible only via its place in the collection.
[Form3, the form with the web browser]
Public Sub LoadWebBrowser( ) If WebBrowserExist s = False Then Dim ax As New AxSHDocVw.AxWeb Browser ax.Dock = DockStyle.Fill Me.Controls.Add (ax) WebBrowserExist s = True WebBrowserIndex = Me.Controls.Cou nt - 1 End If End Sub
As you can see, Form3.Controls( WebBrowserIndex ) is the webbrowser control. Now how do I set the page on the control? Using ax.Navigate within this procedure gives me the following error
'An unhandled exception of type 'InvalidActiveX StateException' occurred in systems.windows .forms.dll'
and is not ideal in any case, since I'm not sure if the object ax will continue to exist outside this procedure. But trying to access the method via
Me.Controls(Web BrowserIndex).N avigate
doesn't work at all, as Navigate is not a member of System.Windows. Forms.Control, despite being a member of _that particular_ control.
Incidentally, if anyone can get Form3 to locate and size appropriately with an axwebbrowser control inside at designtime then this will save me a lot of headaches. But I reckon I'll probably want to access methods of controls in collections sooner or later, so I'll still be grateful for help in this.
DirectCast(Me.C ontrols(WebBrow serIndex),AxSHD ocVw.AxWebBrows er).Navigate
Placing "option strict on" at the top of your form will help you avoid
this issue in the future.
Chris
Chris <no@spam.com> wrote in
news:On******** ******@TK2MSFTN GP10.phx.gbl: DirectCast(Me.C ontrols(WebBrow serIndex),AxSHD ocVw.AxWebBrows er).Nav igate
Placing "option strict on" at the top of your form will help you avoid this issue in the future.
Thanks.
--
Cheers, ymt. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris |
last post by:
Hi,
I'm trying to append text from another class to a generic richTextBox that
I've added to a Windows form. I can't seem to figure out how to expose the
richTextBox to append text to it.
Thanks in advance,
Chris
|
by: FredC |
last post by:
How do you make a program's properties and methods availale so that other
programs can "connect" to them at design time and then use them at run time?
|
by: wh |
last post by:
I have a user control implemented in an .ascx page that I embed in the html
as follows:
<test:mycontrol runat="server" property1="..." property2="..."/>
I'd also like to be able to assign a collection of strings to a property
called 'items' but am unsure of whether this is possible, and if so how it
can be done.
I'd presumably have a property in the codebehind .cs file for the .ascx
|
by: Jeff Smith |
last post by:
Can I load custom web user controls dynamically and access the properties
and methods without having to explicitly define custom control types
(example 2 below). I have custom web control named EditStuff.ascx which
reads from an xml file and loads controls to its self based on string value
in xml nodes collection of the xml.
There are several controls that can be loaded and for each one there exists
a public method called 'IntiControl'...
|
by: John Rivers |
last post by:
Hello,
What good reason there is for not allowing methods in ASPX pages I
can't imagine, but here is how to get around that limitation:
(START)
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<%
| |
by: Dave |
last post by:
Please - anyone that can help.
I am getting confusing results while trying to expose a collection from a
web service.
I have a webservice in which a web method accepts a collection as a
parameter and returns an array of datasets. The collection consists of
database connection objects.
Based on the simple hierarchy below, you can see that starting with the
|
by: =?Utf-8?B?QkogU2FmZGll?= |
last post by:
We have a class that has a public property that is of type List<T>. FXCop
generates a DoNotExposeGenericLists error, indicating
"System.Collections.Generic.List<Tis a generic collection designed for
performance not inheritance and, therefore, does not contain any virtual
members. The following generic collections are designed for inheritance and
should be exposed instead of System.Collections.Generic.List<T>.
*...
|
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= |
last post by:
Hi
I have a user control that is designed as below.
I am creating these User Controls Dynamically in another form. They are
multiple types of User Controls all with a common Interface so I can use a
Factory to create them all in a generic way.
The problem is that if I create a IMyInterface - I cannot access the
derived UserControl Methods.
I need to access the Methods derived from UserControl and also the Interface
|
by: =?Utf-8?B?RGFsZQ==?= |
last post by:
I have an app with a MasterPage. In the MasterPage is a user control with
several public properties and methods that I want exposed to the content page.
Rather than writing several redirection methods to expose the properties, I
would rather just expose the user control as a property of the MasterPage.
The problem is, when I compile, I get an exception on the content page:
The type 'MessageBlock.MessageBlock' is defined in an...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |