Wednesday, May 2, 2012

Dynamic Control Creation


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 dynamic : Form
    {
        public dynamic()
        {
            InitializeComponent();
        }

        private void dynamic_Load(object sender, EventArgs e)
        {
            Button btn = new Button();
            btn.Text = "Click";
            btn.Size = new Size(76, 26);
            btn.Location = new Point(100, 100);
            this.Controls.Add(btn);
            btn.Click += new EventHandler(btn_Click);
        }

        void btn_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Clicked");
          
        }
    }
}

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...