mám problém s OpenFileDialogem
stáhněte si prosím tenhle můj program.
http://www.uloz.to/9834922/auto-simulator-exe
Po spuštění programu stiskněte "R" po té se vám otevře rádio.Po kliknutí na tlačítko Open(otevře se openfiledialog) program háže eror (mě osobně to eror neháže ale všem kterým jsem to poslal to eror háže).
Tady zdroják rádia(rádio je samostatný form)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
namespace Auto_simulator
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
playing = false;
cesta = "";
}
private Audio mp3;
private Boolean playing;
private string cesta;
private void label1_Click(object sender, EventArgs e) //closer
{
this.Hide();
}
private void panel4_Click(object sender, EventArgs e) //open
{
OpenFileDialog musicopn = new OpenFileDialog();
musicopn.Filter = "Hudební soubory" + " (*.mp3)|*.mp3;";
if (musicopn.ShowDialog() == DialogResult.OK)
{
if (playing == true)
{
mp3.Stop();
playing = false;
}
cesta = musicopn.FileName;
if (musicopn.SafeFileName != "")
{
label2.Text = musicopn.SafeFileName;
}
if (cesta != "")
{
mp3 = Audio.FromFile(cesta);
}
if (playing == false)
{
mp3.Play();
playing = true;
}
}
}
private void panel1_Click(object sender, EventArgs e) //Play
{
if (cesta != "")
{
if (playing == false)
{
mp3.Play();
playing = true;
}
}
}
private void panel2_Click(object sender, EventArgs e) //Pause
{
if (cesta != "")
{
if (playing == true)
{
mp3.Pause();
playing = false;
}
}
}
private void panel3_Click(object sender, EventArgs e) //Stop
{
if (cesta != "")
{
if (playing == true)
{
mp3.Stop();
playing = false;
}
}
}
}
}