locked
I am a programming super noob and I need help with C# Express edition RRS feed

  • Question

  • I do not know really anything about programming besides how it works (somewhat). And i have been using the provided tutorial of making a web browser. I have started it twice, and both times it broke. Once I get to the stage of changing the name under properties, it hits a dead end. I tried downloading the video tutorial. But not much success.

    So do you want to guide me through it???
    Monday, January 11, 2010 1:53 AM

All replies

  • Open your C# Express and new a project of Windows Application,

    Open the Form1.Designer.cs, and modify it as follow:

    namespace WindowsFormsApplication2
    {
      partial class Form1
      {
        /// <summary>
        /// 設計工具所需的變數。
        /// </summary>
        private System.ComponentModel.IContainer components = null;
    
        /// <summary>
        /// 清除任何使用中的資源。
        /// </summary>
        /// <param name="disposing">如果應該處置 Managed 資源則為 true,否則為 false。</param>
        protected override void Dispose(bool disposing)
        {
          if (disposing && (components != null))
          {
            components.Dispose();
          }
          base.Dispose(disposing);
        }
    
        #region Windows Form 設計工具產生的程式碼
    
        /// <summary>
        /// 此為設計工具支援所需的方法 - 請勿使用程式碼編輯器
        /// 修改這個方法的內容。
        /// </summary>
        private void InitializeComponent()
        {
          this.textBox1 = new System.Windows.Forms.TextBox();
          this.label1 = new System.Windows.Forms.Label();
          this.button1 = new System.Windows.Forms.Button();
          this.webBrowser1 = new System.Windows.Forms.WebBrowser();
          this.SuspendLayout();
          // 
          // textBox1
          // 
          this.textBox1.Location = new System.Drawing.Point(93, 9);
          this.textBox1.Name = "textBox1";
          this.textBox1.Size = new System.Drawing.Size(390, 22);
          this.textBox1.TabIndex = 0;
          this.textBox1.Text = "http://www.microsoft.com";
          // 
          // label1
          // 
          this.label1.AutoSize = true;
          this.label1.Location = new System.Drawing.Point(56, 13);
          this.label1.Name = "label1";
          this.label1.Size = new System.Drawing.Size(31, 12);
          this.label1.TabIndex = 1;
          this.label1.Text = "URL:";
          // 
          // button1
          // 
          this.button1.Location = new System.Drawing.Point(489, 8);
          this.button1.Name = "button1";
          this.button1.Size = new System.Drawing.Size(75, 23);
          this.button1.TabIndex = 2;
          this.button1.Text = "Browse";
          this.button1.UseVisualStyleBackColor = true;
          this.button1.Click += new System.EventHandler(this.button1_Click);
          // 
          // webBrowser1
          // 
          this.webBrowser1.Location = new System.Drawing.Point(12, 38);
          this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
          this.webBrowser1.Name = "webBrowser1";
          this.webBrowser1.Size = new System.Drawing.Size(552, 307);
          this.webBrowser1.TabIndex = 3;
          // 
          // Form1
          // 
          this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
          this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
          this.ClientSize = new System.Drawing.Size(576, 357);
          this.Controls.Add(this.webBrowser1);
          this.Controls.Add(this.button1);
          this.Controls.Add(this.label1);
          this.Controls.Add(this.textBox1);
          this.Name = "Form1";
          this.Text = "Form1";
          this.ResumeLayout(false);
          this.PerformLayout();
    
        }
    
        #endregion
    
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.WebBrowser webBrowser1;
    
      }
    }
    
    
    

    then, open Form1.cs from the Menu Line by choosing "View" -> "Code"

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication2
    {
      public partial class Form1 : Form
      {
        public Form1()
        {
          InitializeComponent();
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
          if (!string.IsNullOrEmpty(this.textBox1.Text))
          {
            this.webBrowser1.Navigate(this.textBox1.Text);
          }
        }
      }
    }
    
    

    and then press F5 to run debug mode, see if that is what you wanna do~

    good luck~~~


    小中中的學習筆記
    Sunday, July 25, 2010 5:47 AM