際際滷

際際滷Share a Scribd company logo
Vp lecture 2 ararat
 lets users type letters and enter data.
Property Name Description
BackColor Gets or sets the background color of the control.
Font Gets or sets the font of the text displayed by the control.
ForeColor Gets or sets the foreground color of the control.
MaxLength Gets or sets the maximum number of characters the user can type or
paste into the text box control.
Multiline Gets or sets a value indicating whether this is a multiline TextBox
control.
Name Gets or sets the name of the control.
PasswordChar Gets or sets the character used to mask characters of a password in a
single-line TextBox control.
Text Gets or sets the current text in the TextBox.
In this project
 Drag down a Textbox
 Drag down three buttons from common controls
 hello button (by clicking in this button it shows a messagebox (hello))
 exit button (by clicking in this button the application will be closed)
 Hi button (by clicking in this button it will show hi in the textbox
 Changing the backcolor , forecolor and font of button (from properties)
 Changing the backcolor , forecolor and font of Textbox(from properties)
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("hello");
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = "hi";
}
Programming
Data Type
Int
String
Boolian
Double
Float
A data type specifies the size and type of variable values. It is important to use the correct
data type for the corresponding variable; to avoid errors, to save time and memory, but it
will also make your code more maintainable and readable. The most common data types are:
Data type in C#
int myInt = 10;
string myString = hello;
double myDouble = 5.25;
bool myBool = true;
It is also possible to convert data types explicitly by using built-in methods, such as
 Convert.ToBoolean,
 Convert.ToDouble,
 Convert.ToString,
 Convert.ToInt32 (int)
 Convert.ToInt64 (long)
 The most important characteristic
of a label control is the text it
displays.
 That text is also referred to as its
caption and this is what the user
would read.
 Important property is AutoSize.
In this project
 Drag down a three Textbox
 Drag down a three Labels
 Drag down four buttons from common controls
 + button (by clicking in this button textbox3 will show the result of A+B
 - button (by clicking in this button textbox3 will show the result of A-B
 / button (by clicking in this button textbox3 will show the result of A/B
 * button (by clicking in this button textbox3 will show the result of A*B
 Changing the backcolor , forecolor and font of button (from properties)
 Changing the backcolor , forecolor and font of Textbox(from properties)
 Changing the backcolor , forecolor and font of Labels(from properties)
int a, b, c;
private void button3_Click(object sender, EventArgs e)
{
a = Convert.ToInt16(textBox1.Text);
b = Convert.ToInt16(textBox2.Text);
c = a / b;
textBox3.Text = Convert.ToString(c);
}
private void button4_Click(object sender, EventArgs e)
{
a = Convert.ToInt16(textBox1.Text);
b = Convert.ToInt16(textBox2.Text);
c = a * b;
textBox3.Text = Convert.ToString(c);
}
private void button2_Click(object sender, EventArgs e)
{
a = Convert.ToInt16(textBox1.Text);
b = Convert.ToInt16(textBox2.Text);
c = a - b;
textBox3.Text = Convert.ToString(c);
}
private void button1_Click(object sender, EventArgs e)
{
a = Convert.ToInt16(textBox1.Text);
b = Convert.ToInt16(textBox2.Text);
c = a + b;
textBox3.Text = Convert.ToString(c);
}
Vp lecture 2 ararat

More Related Content

Vp lecture 2 ararat

  • 2. lets users type letters and enter data. Property Name Description BackColor Gets or sets the background color of the control. Font Gets or sets the font of the text displayed by the control. ForeColor Gets or sets the foreground color of the control. MaxLength Gets or sets the maximum number of characters the user can type or paste into the text box control. Multiline Gets or sets a value indicating whether this is a multiline TextBox control. Name Gets or sets the name of the control. PasswordChar Gets or sets the character used to mask characters of a password in a single-line TextBox control. Text Gets or sets the current text in the TextBox.
  • 3. In this project Drag down a Textbox Drag down three buttons from common controls hello button (by clicking in this button it shows a messagebox (hello)) exit button (by clicking in this button the application will be closed) Hi button (by clicking in this button it will show hi in the textbox Changing the backcolor , forecolor and font of button (from properties) Changing the backcolor , forecolor and font of Textbox(from properties)
  • 4. private void button1_Click(object sender, EventArgs e) { MessageBox.Show("hello"); } private void button2_Click(object sender, EventArgs e) { Application.Exit(); } private void button3_Click(object sender, EventArgs e) { textBox1.Text = "hi"; }
  • 6. A data type specifies the size and type of variable values. It is important to use the correct data type for the corresponding variable; to avoid errors, to save time and memory, but it will also make your code more maintainable and readable. The most common data types are:
  • 7. Data type in C# int myInt = 10; string myString = hello; double myDouble = 5.25; bool myBool = true;
  • 8. It is also possible to convert data types explicitly by using built-in methods, such as Convert.ToBoolean, Convert.ToDouble, Convert.ToString, Convert.ToInt32 (int) Convert.ToInt64 (long)
  • 9. The most important characteristic of a label control is the text it displays. That text is also referred to as its caption and this is what the user would read. Important property is AutoSize.
  • 10. In this project Drag down a three Textbox Drag down a three Labels Drag down four buttons from common controls + button (by clicking in this button textbox3 will show the result of A+B - button (by clicking in this button textbox3 will show the result of A-B / button (by clicking in this button textbox3 will show the result of A/B * button (by clicking in this button textbox3 will show the result of A*B Changing the backcolor , forecolor and font of button (from properties) Changing the backcolor , forecolor and font of Textbox(from properties) Changing the backcolor , forecolor and font of Labels(from properties)
  • 11. int a, b, c; private void button3_Click(object sender, EventArgs e) { a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a / b; textBox3.Text = Convert.ToString(c); } private void button4_Click(object sender, EventArgs e) { a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a * b; textBox3.Text = Convert.ToString(c); }
  • 12. private void button2_Click(object sender, EventArgs e) { a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a - b; textBox3.Text = Convert.ToString(c); } private void button1_Click(object sender, EventArgs e) { a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a + b; textBox3.Text = Convert.ToString(c); }