Click here to Skip to main content
14,689,511 members
Home » Discussions » C#
   

C#

 
GeneralRe: crystal report data not showing Pin
neodeaths13-Jun-09 21:27
Memberneodeaths13-Jun-09 21:27 
Questiontablet pc application Pin
radhikasharma13-Jun-09 11:40
Memberradhikasharma13-Jun-09 11:40 
Questionshow tooltip even if treeview doesn't have focus? Pin
FocusedWolf13-Jun-09 10:41
MemberFocusedWolf13-Jun-09 10:41 
AnswerRe: show tooltip even if treeview doesn't have focus? Pin
Mycroft Holmes13-Jun-09 17:23
professionalMycroft Holmes13-Jun-09 17:23 
GeneralRe: show tooltip even if treeview doesn't have focus? Pin
FocusedWolf13-Jun-09 19:58
MemberFocusedWolf13-Jun-09 19:58 
GeneralRe: show tooltip even if treeview doesn't have focus? Pin
Mycroft Holmes13-Jun-09 22:07
professionalMycroft Holmes13-Jun-09 22:07 
GeneralRe: show tooltip even if treeview doesn't have focus? Pin
FocusedWolf13-Jun-09 23:01
MemberFocusedWolf13-Jun-09 23:01 
QuestionRead from process Pin
thomaxz.tc13-Jun-09 10:37
Memberthomaxz.tc13-Jun-09 10:37 
I have a process, i can start, and hide working fine, but i want to read from the console program, when i runs, not after, i tried to run a timer, anbd read at the tick, but my program just crashes and when it not do, i get nothing at all.

                 startInfo= new ProcessStartInfo("cmd.exe");
                 startInfo.Arguments ="/C uus.exe "+ arg.ToString();
                 startInfo.RedirectStandardError = true;
                 startInfo.RedirectStandardOutput = true;
                 startInfo.UseShellExecute = false;
                 startInfo.CreateNoWindow = true;
                 this.timer1.Enabled=true;
                 this.listBox1.Items.Clear();
                 p= Process.Start(startInfo);
                     Application.DoEvents();

void Timer1Tick(object sender, EventArgs e)
 {
         string str="";
         str=p.StandardOutput.ReadLine();
         if(str != null)
         {
                 this.Text=str.ToString();
                 this.listBox1.Items.Add(str);
         }
         Application.DoEvents();
 }


So what do i do to solve this?

Update: I tried a solution i found now My program don't crash anymore, but it also don't recevie any data at all

                proc.StartInfo.UseShellExecute=false;
                proc.StartInfo.CreateNoWindow=true;
                proc.StartInfo.RedirectStandardOutput=true;
                proc.StartInfo.RedirectStandardError=true;
                proc.StartInfo.FileName="uus.exe";
                proc.StartInfo.Arguments=arg;
                proc.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(SortOutputHandler);
                proc.Start();
                proc.BeginOutputReadLine();

void SortOutputHandler(object o,System.Diagnostics.DataReceivedEventArgs e)
{
        string str="";
        string str2="";
        str=e.Data.ToString();
        if(str!=null && str!="")
        {
                this.listBox1.Items.Add(str.ToString());
                this.Text=str.ToString();
        }
        str2=proc.StandardOutput.ReadLine();
        if(str2!=null && str2!="")
        {
                this.lsw1.Items.Add(str2.ToString());
        }
}


The program is a process whichs take some arguments, and if no error happends run and close is self, what i'am trying to do is run the process, read how long the process is done with the task, while it does the task not after, and write it in my program

some body have a working solution?
AnswerRe: Read from process Pin
Luc Pattyn13-Jun-09 11:12
sitebuilderLuc Pattyn13-Jun-09 11:12 
GeneralRe: Read from process Pin
thomaxz.tc13-Jun-09 13:29
Memberthomaxz.tc13-Jun-09 13:29 
GeneralRe: Read from process Pin
Luc Pattyn13-Jun-09 13:37
sitebuilderLuc Pattyn13-Jun-09 13:37 
GeneralRe: Read from process Pin
thomaxz.tc13-Jun-09 13:47
Memberthomaxz.tc13-Jun-09 13:47 
GeneralRe: Read from process Pin
Luc Pattyn13-Jun-09 14:37
sitebuilderLuc Pattyn13-Jun-09 14:37 
GeneralRe: Read from process Pin
thomaxz.tc14-Jun-09 0:32
Memberthomaxz.tc14-Jun-09 0:32 
Questionload a lot of Images to memory Pin
nryk13-Jun-09 9:57
Membernryk13-Jun-09 9:57 
AnswerRe: load a lot of Images to memory Pin
Luc Pattyn13-Jun-09 10:37
sitebuilderLuc Pattyn13-Jun-09 10:37 
GeneralRe: load a lot of Images to memory Pin
harold aptroot13-Jun-09 12:55
Memberharold aptroot13-Jun-09 12:55 
GeneralRe: load a lot of Images to memory Pin
Luc Pattyn13-Jun-09 15:29
sitebuilderLuc Pattyn13-Jun-09 15:29 
GeneralRe: load a lot of Images to memory Pin
harold aptroot13-Jun-09 15:36
Memberharold aptroot13-Jun-09 15:36 
GeneralRe: load a lot of Images to memory Pin
Luc Pattyn13-Jun-09 16:17
sitebuilderLuc Pattyn13-Jun-09 16:17 
AnswerRe: load a lot of Images to memory Pin
nryk13-Jun-09 19:05
Membernryk13-Jun-09 19:05 
GeneralRe: load a lot of Images to memory Pin
Dave Kreskowiak13-Jun-09 22:46
mveDave Kreskowiak13-Jun-09 22:46 
AnswerRe: load a lot of Images to memory Pin
Guffa13-Jun-09 22:26
MemberGuffa13-Jun-09 22:26 
GeneralRe: load a lot of Images to memory Pin
nryk13-Jun-09 22:40
Membernryk13-Jun-09 22:40 
GeneralRe: load a lot of Images to memory Pin
harold aptroot13-Jun-09 23:38
Memberharold aptroot13-Jun-09 23:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.