Nothing Special   »   [go: up one dir, main page]

Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

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 Lab1_4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
// MessageBox.Show("Today is " +
// DateTime.Today.ToLongDateString());
textBox1.Text = "Today is " +
DateTime.Today.ToLongDateString();
}

private void button2_MouseHover(object sender, EventArgs e)


{
textBox2.Text = "Noroc!";
}

private void button2_MouseLeave(object sender, EventArgs e)


{
textBox2.Text = "La revedere!";
}

private void button2_Click(object sender, EventArgs e)


{

private void changeText_Click(object sender, EventArgs e)


{
this.label1.Text = "Time " +
DateTime.Now.ToLongTimeString();
}

private void changeColor_Click(object sender, EventArgs e)


{
Random randomColor = new Random();
this.label1.ForeColor = Color.FromArgb(randomColor.Next(0,
256),
randomColor.Next(0, 256), randomColor.Next(0, 256));

private void retrieveInput_Click(object sender, EventArgs e)


{
MessageBox.Show(this.inputText.Text);
}

private void button3_Click(object sender, EventArgs e)


{
int num1, num2, suma;
num1 = Convert.ToInt32(Num1.Text);
num2 = int.Parse(Num2.Text);
suma = num1 + num2;
//Suma.Text = suma.ToString();
Suma.Text = (num1 + num2).ToString();

private void button4_Click(object sender, EventArgs e)


{
textBox1.Text = "Hello World";
textBox1.Select(6, 5);
MessageBox.Show(textBox1.SelectedText);
selectFrom.Select(6, 5);
WriteTo.Text = selectFrom.SelectedText;
}

private void button5_Click(object sender, EventArgs e)


{
Form2 subForm = new Form2(this);
subForm.Show();

private void button6_Click(object sender, EventArgs e)


{
MessageBox.Show("Buna ziua la toti!");
}

}
}

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 Lab1_4
{
public partial class Form2 : Form
{Form1 mainForm;

public Form2(Form1 mainForm)


{
this.mainForm = mainForm;
InitializeComponent();

private void okButton_Click(object sender, EventArgs


e)
{
if (this.textBox1.Text != string.Empty)
{

mainForm.listBox1.Items.Clear();

string[] stringsEntered = textBox1.Lines;


for (int count = 0; count <
stringsEntered.Length; count++)
{

mainForm.listBox1.Items.Add(stringsEntered[count]);

}
this.Close();

You might also like