Hi!

I'm having trouble with the new webbrowser control. I'd like to use the
navigating_event to make some decisions. I tried to use the 'cancel'
property but nothing happens. (look here:
http://msdn2.microsoft.com/en-us/library/5z79szk4) If I simply try:

private void webBrowser1_Navigating(object sender,
WebBrowserNavigatingEventArgs e)
{
e.Cancel = true;
}

Nothing happens. The page is just loaded. Shouldn't this property
prevent that behavior? Any hints?

THX!
Tobias

Re: trouble with events and webbrowser control by Peter

Peter
Mon Oct 10 15:51:39 CDT 2005

Which build are you using? Beta2? RC?

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://www.peterfoot.net

"Tobias Matzat" <tobiasmatzat@freenet.de> wrote in message
news:434aad4c$0$16480$9b4e6d93@newsread4.arcor-online.net...
> Hi!
>
> I'm having trouble with the new webbrowser control. I'd like to use the
> navigating_event to make some decisions. I tried to use the 'cancel'
> property but nothing happens. (look here:
> http://msdn2.microsoft.com/en-us/library/5z79szk4) If I simply try:
>
> private void webBrowser1_Navigating(object sender,
> WebBrowserNavigatingEventArgs e)
> {
> e.Cancel = true;
> }
>
> Nothing happens. The page is just loaded. Shouldn't this property prevent
> that behavior? Any hints?
>
> THX!
> Tobias



Re: trouble with events and webbrowser control by Tobias

Tobias
Tue Oct 11 04:34:38 CDT 2005

Peter Foot [MVP] wrote:
> Which build are you using? Beta2? RC?
>
> Peter
>

Hi!

I'm using Beta2 and the following Code
(...)
private void menuItem1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(new Uri(@"http://mobile.msn.com"));
}

private void webBrowser1_Navigating(object sender,
WebBrowserNavigatingEventArgs e)
{
e.Cancel = true;
MessageBox.Show(@"Forbidden!");
}
(...)

When I click the menu the control should not load the new page. I should
just show the box. I did the same thing with the desktop framework and
there the page is indeed not loaded. But...

??

Tobias