I am built same win Form that opens some website with webBrowser after this i need to run runMyfunction,but this doesn't happens.
Then i run runMyfunction, all stops and when i debug it it stays on
Application.Run(new Form1());
What i am missing here? This my code :
namespace UmbWin
{
static class Program
{
[STAThread]
static void Main()
{
//I tried this also
//Form1 myForm = new Form1();
//myForm.Show();
//myForm.runMyfunction()- doesn't do anything
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
public Form1()
{
InitializeComponent();
}
[STAThread]
private void Form1_Load(object sender, EventArgs e)
{
string authHeader = "User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)";
webBrowser.Navigate("https://www.test.com/Default.aspx", null, null, authHeader);
runMyfunction();
}
public void runMyfunction()
{
//here where it stops and does nothing
HtmlElement head = webBrowser.Document.GetElementById("123");
HtmlElement scriptEl = webBrowser.Document.CreateElement("script");
}