|
OK: to solve your problem, replace "openFileDialog1.FileName" with "play":
if (play != null)
{
System.Media.SoundPlayer simplesound = new System.Media.SoundPlayer(play);
simplesound.Play();
}
And you will hear your noise.
its not working . again the same problem.File not Found exception unhandle on 'simplesound.Play();'
how can attach the file here i will snd u the screen short of my problem.
i try the other code thn tell u.
thanks for helping me.
|
|
|
|
|
Put a breakpoint on the line:
System.Media.SoundPlayer simplesound = new System.Media.SoundPlayer(play); And look at the content of "play": does it look like the address of your file?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
ClickButton.ClickSound = ofd.FileName;
}
this is code for the btn in the form 1?
what would i write in click event? mean on the other btn in form 2 where i want to play sound?
thanks
|
|
|
|
|
aeman wrote: this is code for the btn in the form 1?
Probably not: it is the code for the user to select which sound they want played when they click a button. Where you need to put that is going to be up to you and how your code works!
aeman wrote: what would i write in click event? mean on the other btn in form 2 where i want to play sound?
If you are using the ClickButton, then nothing: once a sound file is set, all ClickButtons will play it automatically: that is why it is a better method than the other suggestions.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
i have solved my problm
thanks u realy help me alot.
m snding som code here so that it will help otherz.
DialogResult result = openFileDialog1.ShowDialog();
Form2 f = new Form2();
f.s1 = openFileDialog1.FileName;
when u select a file assign it to a string.thn on which btn u want to play sound write the following code.
System.Media.SoundPlayer simplesound = new System.Media.SoundPlayer(s1);
simplesound.Play();
there u go
|
|
|
|
|
hmmmm... so your button click event handler in your second form needs to run the same code as it does when in form1. I think your best option is to post you code for both button events (when in form 1) and then post the code you are using for your button click in form2. Then we can help more
return 5;
|
|
|
|
|
I would possibly set up a static event handler in a suitable class and call that from the button click events. If you do this, be sure to unregister the events when you close your forms (this is good practice anyway but essential with static events or event handlers)!
public static void ButtonWithSoundClicked(object sender, EventArgs e)
{
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
button1.Click += YourStaticClass.ButtonWithSoundClicked;
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
button1.Click -= YourStaticClass.ButtonWithSoundClicked;
}
}
|
|
|
|
|
Hi everybody..
sorry for my english but i'm italian..
I need an help to do a program that can broadcast a webcam to another computer in "remote"..
I can choose either P2P program (so i can send frames from PC1 to PC2) or WebPage (in this case webcam client sends its frames to a page in a webserver). I try to do P2P program through UDP and Bitmap.Save but without success in remote (it's well in local)..
So i've found some examples that use RTP and H.264 but it's very difficult to know for me..
I ask you how to do this work and where to find complete tutorials to do..
What about Windows Media Encoder SDK? with this one can i do webcam streaming?
thanks and bye
modified on Friday, February 11, 2011 8:30 AM
|
|
|
|
|
|
Thanks a lot for your link but i'm searching for C#.Net... so i need something that can help me to code a program to broadcast webcam
|
|
|
|
|
DirectX Video Stream and frame capture[^], from The Code Project article archives will not answer your question directly but may get you started in the right direction.
There are several more articles on CP just use the Articles|Search menu at the top of the page.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Without using SqlCommand or CommandBuilder object,
Is it possible to interact with database?
|
|
|
|
|
Yes, you could always use something like ODBCCommand, or is that not what you're asking? If you are using SQL Server, I'd use SqlCommand over the ODBC equivalent anyday because it uses the native SQL driver, rather than having to go via the ODBC transport.
|
|
|
|
|
I am not specific to sql only !
What i want to know without using Oledb, Odbc, Sql, SqlClient namespace
Is it possible to interact with DB ?
Now don't tell you can create your own library from scratch like fraework have
May be i am asking worng ? ( As i don't exactly recall ? )
But it is something like same as my initial post
|
|
|
|
|
Hum Dum wrote: May be i am asking worng ?
Pretty much.
ADO.net relies on derived versions of Connection, Command, and other sundry classes. Each database -- Sql Server, Oracle, MySql, Ingres, Firebird, Cache, etc. -- has its particular classes in some namespace; if you want to use ADO.net, you will need to use the classes in the appropriate namespace.
Or use something (e.g. Linq) that hides the ADO.net so you don't see it even though you're using it.
Or don't use ADO.net -- you can use older database access techniques, but ADO.net is far superior to any others I have used.
|
|
|
|
|
Sounds like a test question.
Certainly you can do without CommandBuilder, but ADO.net requires a Command, even if it's buried in a DataAdapter.
|
|
|
|
|
PIEBALDconsult wrote: Sounds like a test question.
Yup it is !
PIEBALDconsult wrote: even if it's buried in a DataAdapter.
That i know (and is my intial thought) also Odbc, Oledb namespaces.
But without all these namspaces.
Is there any way ?
|
|
|
|
|
Hum Dum wrote: But without all these namspaces.
Is there any way ?
How do you think we did it before ADO.net came along (and lifted us from the dark ages)?
|
|
|
|
|
I don't know about you, but I sacrificed chickens and did the hoodoo dance.
|
|
|
|
|
Ah, PRO*C, I did that too.
|
|
|
|
|
Hum Dum wrote: But without all these namspaces.
Is there any way ?
Well, you could always write your own protocol but that's time consuming, prone to errors and a bit, how shall I put it, boneheaded stupid.
|
|
|
|
|
Hum Dum wrote: But without all these namspaces.Is there any way ?
Those namespaces exist to serve you that very purpose. If you don't want to use any of those, AND you don't want to write your own stuff from scratch, then the only way is to p/invoke into the beast and use one of the things it has to offer.
Then it would be pointless to use .NET.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Hum Dum wrote: Without using SqlCommand or CommandBuilder object,
Is it possible to interact with database?
Yes, by capturing the output of SQLCMD/Isql.exe for example.
I are Troll
|
|
|
|
|
I hadn't thought of that. MySql also has a command-line utility.
|
|
|
|
|