[dba-VB] FYI: LINQPad - you can run (m)any (types of) code snippets, even WinForms etc.

Salakhetdinov Shamil mcp2004 at mail.ru
Tue Jun 19 12:54:38 CDT 2012


Hi All --

FYI: You can run the following (see P.S.)  code snippets in LINQPad to create sample WinForm instance with one button reacting on its clicking by an informational message box dialog:

Hello, World!
	
Thank you.

-- Shamil

static void Main() { Application.Run(new HelloWorldWinForm()); }

//namespace My.TestConsole
//{
	public partial class HelloWorldWinForm : System.Windows.Forms.Form
	{
		public HelloWorldWinForm()
		{
			InitializeComponent();
		}
		
	    private void cmdClickMe_Click(object sender, EventArgs e)
		{
			MessageBox.Show("Hello World!", "Hello", MessageBoxButtons.OK, MessageBoxIcon.Information);  
		}
	
	}
//}

//namespace My.TestConsole
//{
	public partial class HelloWorldWinForm : System.Windows.Forms.Form
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}

		#region Windows Form Designer generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.cmdClickMe = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// cmdClickMe
			// 
			this.cmdClickMe.Location = new System.Drawing.Point(93, 48);
			this.cmdClickMe.Name = "cmdClickMe";
			this.cmdClickMe.Size = new System.Drawing.Size(75, 23);
			this.cmdClickMe.TabIndex = 0;
			this.cmdClickMe.Text = "Click Me!";
			this.cmdClickMe.UseVisualStyleBackColor = true;
			this.cmdClickMe.Click += new System.EventHandler(this.cmdClickMe_Click);
			// 
			// HelloWorldWinForm
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(262, 127);
			this.Controls.Add(this.cmdClickMe);
			this.Name = "HelloWorldWinForm";
			this.Text = "Hello World WinForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			
			this.ResumeLayout(false);

		}

		#endregion

		private System.Windows.Forms.Button cmdClickMe;
	}
//}




More information about the dba-VB mailing list