trouble with events and webbrowser control

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
 
T

Tobias Matzat

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top