แบบฝึกหัด







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

        private void get_text_Click(object sender, EventArgs e) {
            MessageBox.Show(messageText.Text, "Output");

        }
    }
}








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

        private void add_Click(object sender, EventArgs e)
        {
            Int32 A,B,X;
            A = Convert.ToInt32(input_A.Text); //เปลี่ยนข้อมูลเป็นตัวเลข
            B = Convert.ToInt32(input_B.Text); //เปลี่ยนข้อมูลเป็นตัวเลข
            X = A + B;
            output.Text=X.ToString(); //เปลี่ยนตัวเลขเป็นสตริงแล้วแสดงผล
        }
    }
}



โปรแกรมที่ 12.3













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


        private void show_Click(object sender, EventArgs e)
        {
            image.ImageLocation = "D:\\5321404077_pai\\pic1.jpg";
            image.Load();  
        }


        private void delete_Click(object sender, EventArgs e)
        {
            image.Image = null;
        }
    }
}