Complete set: Intro to C - Bill Buchanan
Complete set: Intro to C - Bill Buchanan
Complete set: Intro to C - Bill Buchanan
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Thus, we can say that a But<strong>to</strong>n is a kind of Forms (excuse the poor use of English,<br />
though). Program 7.5 shown an example program with a form, a textbox and a but<strong>to</strong>n.<br />
It can be seen that the form is defined as a class with:<br />
Derived class<br />
public class Form1 : System.Windows.Forms.Form<br />
Base class<br />
which means that our form derives from System.Windows.Forms.Form. The<br />
but<strong>to</strong>n and the text box are defined with:<br />
private System.Windows.Forms.But<strong>to</strong>n but<strong>to</strong>n1;<br />
private System.Windows.Forms.TextBox textBox1;<br />
Which means they derive from System.Windows.Forms.But<strong>to</strong>n and System.Windows.Forms.TextBox,<br />
respectively.<br />
Program 7.5:<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
namespace WindowsApplication3<br />
{<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
private System.Windows.Forms.But<strong>to</strong>n but<strong>to</strong>n1;<br />
private System.Windows.Forms.TextBox textBox1;<br />
Base class<br />
public Form1() { InitializeComponent(); }<br />
private void InitializeComponent()<br />
{<br />
this.but<strong>to</strong>n1 = new System.Windows.Forms.But<strong>to</strong>n();<br />
this.textBox1 = new System.Windows.Forms.TextBox();<br />
duction <strong>to</strong> .NET<br />
<strong>Intro</strong><br />
}<br />
this.but<strong>to</strong>n1.Location = new System.Drawing.Point(152, 192);<br />
this.but<strong>to</strong>n1.Name = "but<strong>to</strong>n1";<br />
this.but<strong>to</strong>n1.TabIndex = 0;<br />
this.but<strong>to</strong>n1.Text = "but<strong>to</strong>n1";<br />
this.textBox1.Location = new System.Drawing.Point(80, 64);<br />
this.textBox1.Name = "textBox1";<br />
this.textBox1.TabIndex = 1;<br />
this.textBox1.Text = "textBox1";<br />
this.Controls.Add(this.textBox1);<br />
this.Controls.Add(this.but<strong>to</strong>n1);<br />
this.Name = "Form1";<br />
this.Text = "Form1";<br />
this.Load += new System.EventHandler(this.Form1_Load);<br />
this.ResumeLayout(false);<br />
Agilent .NET Course: Objects 10