bonjour à tous,
voilà, apres un peu plus d'un mois d'apprentissage du langage, je tombe sur un os qui me fait perdre la boule.
ceci fonctionne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 public partial class Form5 : Form { public System.Windows.Forms.WebBrowser wb; public Form5() { InitializeComponent(); WebBrowser wb = new WebBrowser(); string url = "http://www.google.com"; wb.Navigate(new Uri(url)); } private void Form5_Load(object sender, EventArgs e) { var page = @" < html > < head > < meta http - equiv ='X-UA-Compatible' content='IE=edge' /> </ head > < body > <iframe frameborder='0' scrolling='no' width='600' height='700' src=http://google.com iframe> </ body > </ html >"; wb.DocumentText = page; wb.ScriptErrorsSuppressed = false; } }
ma question :
pourquoi ai-je l'impression d'être obligé de déclarer et d'instancier ce bout de code sous "InitializeComponent()" et non pas dans form_load comme suit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 public partial class Form5 : Form { public System.Windows.Forms.WebBrowser wb; public Form5() { InitializeComponent(); } private void Form5_Load(object sender, EventArgs e) { WebBrowser wb = new WebBrowser(); string url = "http://www.google.com"; wb.Navigate(new Uri(url)); this.Controls.Add(wb); var page = @" < html > < head > < meta http - equiv ='X-UA-Compatible' content='IE=edge' /> </ head > < body > <iframe frameborder='0' scrolling='no' width='600' height='700' src=http://google.com iframe> </ body > </ html >"; wb.DocumentText = page; wb.ScriptErrorsSuppressed = false; } }
et comme je souhaite modifier le document pour la compatibilité ie, comme faire fonctionner document.text ?
je suis completement perdu ... moi qui pensais avoir compris des petites choses et qui n'avais pas eu trop de problème de déclaration ni d'instanciation de tableaux de combobox de list etc....
alors je suis tout ouie et au laisir de vous lire avec impatience ....
++
Partager