private void button_ToMIDI_Click(object sender, EventArgs e) { if (textBox_Notes.Text.Length != 0) { SaveFileDialog dlg = new SaveFileDialog(); dlg.DefaultExt = "mid"; dlg.FileName = "Output.mid"; if (dlg.ShowDialog() != DialogResult.OK) { return; } this.Cursor = Cursors.WaitCursor; MusicNoteLib.SaveAsMidiFile(textBox_Notes.Text, dlg.FileName); this.Cursor = Cursors.Default; } else { MessageBox.Show("Text box is empty !! Enter few notes and then use this option to save them to MIDI output file"); } }