Hi, I have a problem and can't find a solution for it:
I have this code that should add a new page to the ...UI.Docking.DocumentWindow on Form1. If I use it on a button on Form1 works fine, but if I try to call it from Form2 the code runs through and show's the messageBox on the end but it doesn't add the page, here's the code:
This one works just fine, but here comes the problem:
I have this on my form2:
and the code for "form1.newBlankProject();" is the same as above, but for some reason it only show's the messagebox with the text "Done2" and nothing else happens. Here's the code for that one too:
Probably is just a stupid mistake on my part, but I can't figure out what the problem may be, any help or ideas are appreciated,
Thanks,
Z
I have this code that should add a new page to the ...UI.Docking.DocumentWindow on Form1. If I use it on a button on Form1 works fine, but if I try to call it from Form2 the code runs through and show's the messageBox on the end but it doesn't add the page, here's the code:
private void mNextP1_Click(object sender, EventArgs e){ string txt = File.ReadAllText("c:\\1.html"); string style = File.ReadAllText("c:\\styles.css"); Form f = new Form(); f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; f.Dock = DockStyle.Fill; WebBrowser wb = new WebBrowser(); wb.DocumentText = ""; wb.Dock = DockStyle.Fill; doc = wb.Document.DomDocument as IHTMLDocument2; doc.designMode = "On"; doc.write(txt); IHTMLStyleSheet styleSheet = doc.createStyleSheet("", 0); styleSheet.cssText = style; f.Controls.Add(wb); DocumentWindow dw = new DocumentWindow(); f.TopLevel = false; dw.Controls.Add(f); f.Show(); dw.Text = "Contents"; radDock1.AddDocument(dw); radDock1.ActiveWindow = dw; MessageBox.Show("Done");}I have this on my form2:
Form1 form1 = new Form1();form1.newBlankProject();and the code for "form1.newBlankProject();" is the same as above, but for some reason it only show's the messagebox with the text "Done2" and nothing else happens. Here's the code for that one too:
public void newBlankProject(){ string txt = File.ReadAllText("c:\\1.html"); string style = File.ReadAllText("c:\\styles.css"); Form f = new Form(); f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; f.Dock = DockStyle.Fill; WebBrowser wb = new WebBrowser(); wb.DocumentText = ""; wb.Dock = DockStyle.Fill; doc = wb.Document.DomDocument as IHTMLDocument2; doc.designMode = "On"; doc.write(txt); IHTMLStyleSheet styleSheet = doc.createStyleSheet("", 0); styleSheet.cssText = style; f.Controls.Add(wb); DocumentWindow dw = new DocumentWindow(); f.TopLevel = false; dw.Controls.Add(f); f.Show(); dw.Text = "Contents"; radDock1.AddDocument(dw); radDock1.ActiveWindow = dw; MessageBox.Show("Done2");}Probably is just a stupid mistake on my part, but I can't figure out what the problem may be, any help or ideas are appreciated,
Thanks,
Z