Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace First_Project
{
public class WinForm : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public System.Windows.Forms.Label lblChalkboard;
public System.Windows.Forms.Button btnLearn;
public System.Windows.Forms.Button btnDontLearn;
public WinForm()
{
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.lblChalkboard = new System.Windows.Forms.Label();
this.btnLearn = new System.Windows.Forms.Button();
this.btnDontLearn = new System.Windows.Forms.Button();
this.SuspendLayout();
this.lblChalkboard.Location = new System.Drawing.Point(32, 88);
this.lblChalkboard.Name = "lblChalkboard";
this.lblChalkboard.Size = new System.Drawing.Size(240, 48);
this.lblChalkboard.TabIndex = 0;
this.lblChalkboard.Text = "Do you want to learn?";
this.btnLearn.Location = new System.Drawing.Point(32, 176);
this.btnLearn.Name = "btnLearn";
this.btnLearn.Size = new System.Drawing.Size(72, 24);
this.btnLearn.TabIndex = 1;
this.btnLearn.Text = "Learn";
this.btnLearn.Click += new System.EventHandler(this.btnLearn_Click);
this.btnDontLearn.Location = new System.Drawing.Point(128, 176);
this.btnDontLearn.Name = "btnDontLearn";
this.btnDontLearn.Size = new System.Drawing.Size(80, 24);
this.btnDontLearn.TabIndex = 2;
this.btnDontLearn.Text = "Dont Learn";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.btnDontLearn);
this.Controls.Add(this.btnLearn);
this.Controls.Add(this.lblChalkboard);
this.Name = "WinForm";
this.Text = "Teach Genia OOP C#";
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new WinForm());
}
private void btnLearn_Click(object sender, System.EventArgs e)
{
lblChalkboard.Text = "I'm not a good teacher, go search on google :P";
}
private void btnDontLearn_Click(object sender, System.EventArgs e)
{
lblChalkboard.Text = "Yeah... that was probably a safe bet, huh.";
}
}
}
(I started learning C# today...)
EDIT: It's .Text not .text, like I said, I started today.
EDIT 2: This wasn't meant to be taken serious, I highly don't recommend learning C# as your beginning language, however I just found my old PHP tutorials so I'll post those.