Click here to Skip to main content
15,881,859 members
Articles / Programming Languages / C#

ProjectMIDI: an extensible set of small MIDI .NET programs

Rate me:
Please Sign up or sign in to vote.
4.70/5 (14 votes)
24 Jan 200626 min read 85.1K   3.4K   57  
This article describes how multiple .NET assemblies work together to control MIDI devices in a live performance environment.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;

namespace ConnectionsNS
{
	/// <summary>
	/// Summary description for ConnectionNameForm.
	/// </summary>
	public class ConnectionNameForm : System.Windows.Forms.Form
	{
		private string name;

//		public string Name 
//		{ 
//			get { return nameTextBox.Text; }
//			set { nameTextBox.Text = value; }
//		}

		#region Windows Controls
		private System.Windows.Forms.TextBox nameTextBox;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button browseButton;
		private System.Windows.Forms.Button cancelButton;
		private System.Windows.Forms.Button okButton;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		#endregion

		public ConnectionNameForm()
		{
			InitializeComponent();

			//nameTextBox.Text = name;
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(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.nameTextBox = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.browseButton = new System.Windows.Forms.Button();
			this.cancelButton = new System.Windows.Forms.Button();
			this.okButton = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// nameTextBox
			// 
			this.nameTextBox.Location = new System.Drawing.Point(144, 8);
			this.nameTextBox.Name = "nameTextBox";
			this.nameTextBox.Size = new System.Drawing.Size(200, 20);
			this.nameTextBox.TabIndex = 0;
			this.nameTextBox.Text = "Name";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(136, 16);
			this.label1.TabIndex = 1;
			this.label1.Text = "New Connection Name:";
			// 
			// browseButton
			// 
			this.browseButton.Location = new System.Drawing.Point(344, 8);
			this.browseButton.Name = "browseButton";
			this.browseButton.Size = new System.Drawing.Size(16, 16);
			this.browseButton.TabIndex = 2;
			this.browseButton.Text = ">";
			this.browseButton.Click += new System.EventHandler(this.browseButton_Click);
			// 
			// cancelButton
			// 
			this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cancelButton.Location = new System.Drawing.Point(288, 40);
			this.cancelButton.Name = "cancelButton";
			this.cancelButton.TabIndex = 3;
			this.cancelButton.Text = "Cancel";
			// 
			// okButton
			// 
			this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.okButton.Location = new System.Drawing.Point(208, 40);
			this.okButton.Name = "okButton";
			this.okButton.TabIndex = 4;
			this.okButton.Text = "OK";
			// 
			// ConnectionNameForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(376, 70);
			this.Controls.Add(this.okButton);
			this.Controls.Add(this.cancelButton);
			this.Controls.Add(this.browseButton);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.nameTextBox);
			this.Name = "ConnectionNameForm";
			this.Text = "Connection Name";
			this.Load += new System.EventHandler(this.ConnectionNameForm_Load);
			this.ResumeLayout(false);

		}
		#endregion

		#region Browse Button
		// BROWSE BUTTON CLICKED
		private void browseButton_Click(object sender, System.EventArgs e)
		{
			OpenFileDialog dlg = new OpenFileDialog();
			dlg.Filter = "PDF Files|*.pdf|TIFF Files|*.tif|All Files|*.*";
			if(dlg.ShowDialog()==DialogResult.OK)
			{
				nameTextBox.Text = Path.GetFileNameWithoutExtension(dlg.FileName);
			}
		}
		#endregion

		// FORM LOAD
		private void ConnectionNameForm_Load(object sender, System.EventArgs e)
		{
			Console.WriteLine("Connection form loaded");
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
United States United States
Ron is a senior software engineer.
His hobbies include riding motorcycles, travel, and scuba diving.

He enjoys learning about science, particularly quantum physics and cosmology.

He is active with his church where he plays drums and keyboards with the contemporary church band each week.
He also designed and maintains his church and band websites (http://TheRockUMC.org and http://TheRockBand.org).

Comments and Discussions