|
Hello electriac!
Was my fault!
Just looked it up again in the documentation.
"EnableRaisingEvents" (per default "false") just has an effect on the "Exited" event.
I mostely use the "Exited" event because I need my program run parallel to the started process.
Again sorry for bringing a wrong statement.
P.S.: Maybe you just didn't showed it in your code snipped, but you should always dispose the process instance if you don't use it anymore. (I always use a "using" statement for that reason).
All the best,
Martin
|
|
|
|
|
I am not too knowledgable I just make things work. How about showing me some code.
Your explanations are too vague for me to interpret. Demonstrate "using" so I can know what your talking about. I'm still writing C++ in Linux and a lot of this C# stuff is foreign to me.
Sample code is best for hackers.
Electriac
|
|
|
|
|
using(Process proc = ...)
{
//Use the process instance "proc" here!
}
//Will be automatically disposed here, even in case of an exception.
All the best,
Martin
|
|
|
|
|
I have used the code as included above for several years without problem. I have tried to implement your suggestion and can not get any thing that will compile. How a about rewriting my suggestion with your addition. A complete snippet. Complete code is insructive. Explanations are usually vague and difficult to implement. Notice the user is already using my submitted snippet.
electriac
-- modified at 18:03 Sunday 8th April, 2007
|
|
|
|
|
Hello electriac!
electriac wrote: I have used the code as included above for several years without problem.
electriac wrote: Notice the user is already using my submitted snippet
I never wanted to say that your code is wrong, it's just not disposing the process instance (which means that the GC will not free the memory the instance used).
electriac wrote: How a about rewriting my suggestion with your addition. A complete snippet.
using(Process proc= Process.Start(YourFilename))
{
proc.WaitForExit();
int ret = proc.ExitCode;
}
Process proc= Process.Start(YourFilename)
proc.WaitForExit();
int ret = proc.ExitCode;
proc.Dispose();
All the best,
Martin
|
|
|
|
|
Thanks electriac ..
my problem was solved.
i used your code and solved.
thsnks
|
|
|
|
|
Thanks should go to Steven Baulkum at Iron Mountain Ranch who gave me the snippet.
Electriac
|
|
|
|
|
hi
i want to playback avi stream in my app,how to do ?
|
|
|
|
|
hi.. i wrote a simple mailing program.. it seems to work at times and fails sometimes.. please help.. whenever it fails it throws an SmtpException.. but it works most of the times.. the code is this..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
namespace hope
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
string sender1;
string recip;
string messg;
string subject = "Hope this reaches!!!";
sender1 = textBox1.Text.ToString();
recip = textBox2.Text.ToString();
messg = textBox3.Text.ToString();
sendmail(sender1, recip, messg, subject);
label1.Text = recip;
}
public static void sendmail(string sendr, string rec, string msg, string sub)
{
//create the mail message
MailMessage mail = new MailMessage();
//set the addresses
mail.From = new MailAddress(sendr);
mail.To.Add(rec);
//set the content
mail.Subject = sub;
mail.Body = msg;
//send the message
SmtpClient smtp = new SmtpClient("localhost");
smtp.Port = 465;
//try
//{
smtp.Send(mail);
//}
//catch (Smtp
}
}
}
please let me knw people..
|
|
|
|
|
Unrelated to your code,
I did a similar project in school with Java. Problems I dealt with were:
1. My ISP would not allow my code to run from home for security reasons unless I had a valid email address as the FROM.
2. Some ISP will block it entirely if you do not have a business account (Not likely an intermittent problem).
3. When at school, if I processed the messages too fast, an error would occur, which I fixed with a small 10ms delay in the loop sending the mail. I found this because I could type in a terminal window to send the mails faster than the school would allow them to send
Good Luck
|
|
|
|
|
I'm writing a little media player but I don't know where to position the Video thisVideo = new Video(); line
At the moment I get 'Video is innacessable due to its protection level'.
I have thisVideo.Stop(), Play etc in event handlers and I am using an OpenFileDialog to open media files.
I correctly have using Microsoft.DirectX.AudioVideoPlayback; at the top of the code and the corresponding .NET reference for that library shown in solution explorer.
I am using .NET framework 1.1 and vs2003.
Robert Everett
|
|
|
|
|
Ah, I've found I have to specify a text string (the file to open) in the constructor in that declaration!
|
|
|
|
|
Hai Frenz,
i want to assosiate different icons for different file programatically using C#. i tried bu creating res file. but still after running the code it is not changing the icons... plzz help me out in this...
Rohitha
|
|
|
|
|
This will depend on the type of file you want to change its icon:
If it's your project's file then you can change that in your project's properties. Once you rebuild you'll see the new icon
If it's another type of file like WAV, AVI, MP#, etc.. You have to associate that file type with the software that contains the icon you wish to use.
Regards
|
|
|
|
|
thnks for reply. here i am changing a file which is not havin an icon by default, also that file is creating by me after the execution of my project. wht i want is, if installed this project in som other system there also it should show the same icon which i am giving. i wanna do it programatically.
Rohitha
|
|
|
|
|
Rohithaa wrote: that file is creating by me after the execution of my project.
If so, go to the properties of your project => Application => Change the icon.
Regards
|
|
|
|
|
Hi
I can't use controls like TextBox or DataGridView in simple Class which i added it from Solution Explorer to my project. It seems that needs System.Windows.Form namespace. My problem is this : Class should inherits from "Form Class" for identifying controls and in this case its behavior converts to Form behavior.
<br />
using System.Windows.Form;<br />
.<br />
public class MyClass : Form<br />
{<br />
}<br />
Is there another way to using controls in class without Inheriting from Form?
Tanx
|
|
|
|
|
You class doesn't need to inherit form Form class to recognize the Controls classes, yet it has to inherit from Form class to display those controls as a windows form, unless you got another way of displaying them.
Simply add a
using System.Windows.Forms;
statement to the top of the file, and all Controls -eg. TextBox, ComboBox, etc...- should be recognizable in your code.
Regards
|
|
|
|
|
Hi,
I have several almost identical datagridviews on a form and I want the cellClick event on each of them to refer to the same event code.
I need to know which datagridview triggered the event. I have each dgv have it's own individual tag and I would like to read the tag of the sending dgv.
I can't discover how to read this information although I am sure it is available.
Any ideas please.
TIA
Glen Harvy
|
|
|
|
|
You can't get it from the sender parameter of the event?
only two letters away from being an asset
|
|
|
|
|
That's what I thought but how do you do this.
I try sender. but only get equals, get, get and tostring?
Glen Harvy
|
|
|
|
|
Ok. What error you got?
Regards,
Satips.
|
|
|
|
|
I don't get an error because I don't know how to get the value in the tag.
Here it is:-
<br />
private void bookingCellClick(object sender, DataGridViewCellEventArgs e)<br />
{<br />
}<br />
Obviously I have a fair bit of code in there which works fine when I hard code the value in the datagridview.tag .
Psuedo code would I guess be "sender.Tag.ToString()" .
Glen Harvy
|
|
|
|
|
Yes. Try with the code and tell or paste the code what you have tried in full so that i can get an idea what u have done.
Hope you got me.
Regards,
Satips.
|
|
|
|
|
You need to cast sender to the actual data type of the control. Since your sender is a DataGridView , you would need something like this:
private void bookingCellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridView dgv = sender as DataGridView;
object tag = dgv.Tag;
}
What, exactly, are you trying to accomplish by accessing the Tag property of the control itself rather than data from the actual cell that was clicked? Pretty much anything you need should be available from the e paramater of the event handler.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|