///NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///
// First add a Button and 4 TextBoxes to Form1.
///NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace APRON
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
///NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///
// Variable 1 is declared as a string and
// the string can hold a series of characters
private string m_strMyName;
// Variable 2 is declared as an integer
// interger can hold numbers (..-2,-1,0,1,2,3...n)
private int m_nMyYear;
// Variable 2 is declared as double
// double can hold decimal numbers 1.5 or -2.7 etc
private double m_dMyNumber;
// Variable 4 is also declared as a string,
// but let's define this string
private string m_strEkstra = "Thank you!";
///NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private string a = "Yo!";
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
///NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///
// The form load is the initialization section of your program
// The program reads this procedure first
private void Form1_Load(object sender, System.EventArgs e)
{
// define myName set the content as "Mr Cool"
this.m_strMyName = "Mr Cool";
// define myYear set the value as 2002
this.m_nMyYear = 2002;
// define myNumber set the value as 8.8
this.m_dMyNumber = 8.8;
}
private void button1_Click(object sender, System.EventArgs e)
{
// Text out, the content of myName
textBox1.Text = this.m_strMyName;
// Text out, the value of myNumber
textBox4.Text = this.m_strEkstra;
// use the ToString() method to pass the variable content as a string
// Text out, the value of myYear
textBox2.Text = this.m_nMyYear.ToString();
// Text out, the value of myNumber
textBox3.Text = this.m_dMyNumber.ToString();
}
///NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///////NEW///
}
}
|