woohoo.cs

Funny C# Winforms project/tutorial I built with one of my students. Inspired by woohooooo.com. Executable version coming soon…

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WoohooWinform
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Find File Path to Main Directory (Contains Main Program and Additional Files)
string pathToDirectory = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
// Create SoundPlayer Object Which Will Play Our WAV File
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
// Tell The SoundPlayer Object Where Our WAV File is Located
player.SoundLocation = pathToDirectory + @"\woohoo.wav";
// Say Woohoo!
player.Play();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
view raw woohoo.cs hosted with ❤ by GitHub
 

topherPedersen