You will see I have a webBroser to which I pass a url like this:
public Marcador()
{
InitializeComponent();
}
public void playGol(String url)
{
webBrowser1.Navigate(url);
}
When I call the method playGol()
from another form webBroser1
it doesn't show me anything, a blank screen, however if I put the sentence: webBrowser1.Navigate("http://---");
in the constructor the web loads me correctly, does anyone know why it happens? (The URL parameter gets the web address well)
Another thing is that I try to open a SWF and what it does is open Chrome and download the file, how can I make it open webBroser
and not chrome and show me (not download) the SWF?
Thanks in advance
Edit: I call it from another form:
private void btnGol_Click(object sender, EventArgs e)
{
Marcador marcador = new Marcador();
marcador.playGol(@"C:\gol2.swf");
}
I don't know how you call
Form
from the other, but imagining you have some global class for it:Class
AdministradorDeForms
, handles your forms in the program:Form1 (The
Form
one with theWebBrowser
):Form2 (The
Form
one you are going to call toForm1
navigate):In
AlgunObjeto_Accion(...)
it you must change the name and its event parameters for the object that is going to execute the navigation in the otherForm
and the classAdministradorDeForms
instantiates it at the beginning of the program, invoid Main()
your application.EDIT : For what you implement, you are calling a new instance from a button, it is better to do this following:
Let's imagine that you have your form like this
Marcador
:And in this
Form
you have the button: