trouble with events and webbrowser control

  • Thread starter Thread starter Tobias Matzat
  • Start date Start date
T

Tobias Matzat

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
 
Peter said:
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
 
Back
Top