0
using System;
using System.Windows.Forms;
using System.Security.Permissions;

I aquire some permission

[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]

The start of Program class

public class Program : Form

{       

I declare a WebBrowser

    private WebBrowser webBrowser;

My constructor

    public Program()
    {
        InitialiseForm();
    }

I innitialise variables and do some layout coding

    public void InitialiseForm()
    {
        webBrowser = new WebBrowser();
        Controls.AddRange(new Control[] {webBrowser});
        webBrowser.ScriptErrorsSuppressed = true;
        webBrowser.Dock = DockStyle.Fill;

I attempt to navigate to nationalgeographic.com. Other websites like google.com and facebook.com are being displayed properly. However some like throwawaymail.com and nationalgeographic are being displayed with alot of elements apparently missing.

        webBrowser.Navigate("http://www.nationalgeographic.com/");

    }

    [STAThread]

My main method

    public static void Main()
    {
        Application.EnableVisualStyles();
        Application.Run(new Program());
    }
}
John
  • 86
  • 10
  • The WebBrowser control hosts a particular version of the Internet Explorer rendering engine. Generally this is an old version, which doesn't support all features used on those websites. What have you tried? – CodeCaster Jan 16 '17 at 12:11
  • I have tried the above code and I have tried googling for a solution with no success. And what is with you guys and the downvotes. Gosh. Is it too hard to just ask me some questions. – John Jan 16 '17 at 12:13
  • Okay Thanks. Was that so hard. But please stop those annoying pointless downvotes. Your making StackOverflow limit the number of questions I can ask per day. – John Jan 16 '17 at 12:16
  • 1
    Maybe you should search for an answer before asking and you won't get downvotes... – Pikoh Jan 16 '17 at 12:19
  • Let me try that solution..... – John Jan 16 '17 at 12:31
  • Okay, I have studied it and it appears that I am supposed to call the "Form1_Load(object sender, EventArgs e)" method in that code. Now, My question is, what are those "Object sender" and "EventArgs e" parameters for. As in, what exactly am I supposed to pass into that method? – John Jan 16 '17 at 12:58
  • That's the Load event. It's called for you when the form is loaded. – CodeCaster Jan 16 '17 at 13:00
  • Huh! so that method is overridden from the Forms class? – John Jan 16 '17 at 13:04
  • Use `@username` to notify people of your replies (unless you're responding to the post owner, like I am now). It doesn't matter where you copy-paste the code from the duplicate. A Form's Load event is not overridden, it is subscribed to. You can do this in the designer, very basic WinForms stuff. Or instead paste the code in your `InitialiseForm()`. Anyway read [ask] and share your research. This is not a forum, and if your question is closed as duplicate, don't continue your question in comments. :) – CodeCaster Jan 16 '17 at 13:08
  • Okay. Ill use the @username thingy. Don't close my question as duplicate, that's a really mean thing to do. Thanks for the tip. Now, I'm still kinda confused. I thought putting a method into a method in c# will result to a compile-time error. How can I paste all that code into my "Initialiseform()" method yet that code contains other methods? – John Jan 16 '17 at 13:16

0 Answers0