fork download
  1.  
  2. /*
  3. Professional Windows GUI Programming Using C#
  4. by Jay Glynn, Csaba Torok, Richard Conway, Wahid Choudhury,
  5.   Zach Greenvoss, Shripad Kulkarni, Neil Whitlow
  6.  
  7. Publisher: Peer Information
  8. ISBN: 1861007663
  9. */
  10.  
  11. using System;
  12. using System.Windows.Forms;
  13. using System.Drawing;
  14. using AxSHDocVw;
  15.  
  16. public class WebBrowser : Form
  17. {
  18. private AxWebBrowser browser;
  19. private Button goButton;
  20. private TextBox addressBox;
  21. private Panel panel1;
  22. private Panel panel2;
  23.  
  24. public WebBrowser()
  25. {
  26. panel1 = new Panel();
  27. panel2 = new Panel();
  28. browser = new AxWebBrowser();
  29. browser.BeginInit();
  30.  
  31. this.SuspendLayout();
  32. panel1.SuspendLayout();
  33. panel2.SuspendLayout();
  34.  
  35. this.Text = "MyWebBrowser";
  36. panel1.Size = new Size(300, 30);
  37. panel1.Dock = DockStyle.Top;
  38.  
  39. panel2.Size = new Size(285,240);
  40. panel2.Location = new Point(5, 31);
  41. panel2.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
  42.  
  43. browser.Dock = DockStyle.Fill;
  44.  
  45. addressBox = new TextBox();
  46. addressBox.Size = new Size(260, 20);
  47. addressBox.Location = new Point(5,5);
  48. addressBox.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left;
  49.  
  50. goButton = new Button();
  51. goButton.Image = Image.FromFile("Arrow.ico");
  52. goButton.Location = new Point(270,5);
  53. goButton.Size = new Size(20,20);
  54. goButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
  55.  
  56. panel1.Controls.AddRange(new Control[] { addressBox, goButton });
  57. panel2.Controls.Add(browser);
  58. this.Controls.AddRange(new Control[] { panel1, panel2 });
  59.  
  60. browser.EndInit();
  61. panel1.ResumeLayout();
  62. panel2.ResumeLayout();
  63. this.ResumeLayout();
  64.  
  65. goButton.Click += new EventHandler(goButton_Click);
  66. browser.GoHome();
  67. }
  68.  
  69. private void goButton_Click(object sender, EventArgs e)
  70. {
  71. object o = null;
  72. browser.Navigate(addressBox.Text, ref o, ref o, ref o, ref o);
  73. }
  74.  
  75. [STAThread]
  76. public static void Main()
  77. {
  78. Application.Run(new WebBrowser());
  79. }
  80. }
  81.  
  82.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(12,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(14,7): error CS0246: The type or namespace name `AxSHDocVw' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(18,12): error CS0246: The type or namespace name `AxWebBrowser' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(19,12): error CS0246: The type or namespace name `Button' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(20,12): error CS0246: The type or namespace name `TextBox' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(21,12): error CS0246: The type or namespace name `Panel' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(22,12): error CS0246: The type or namespace name `Panel' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 7 error(s), 0 warnings
stdout
Standard output is empty