Last active
September 28, 2019 03:25
-
-
Save topherPedersen/77c57c626b1a8ce35bc0630909e444f3 to your computer and use it in GitHub Desktop.
Woohoo Winforms Lesson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment