|
thnks zaher but it doesnt work.....
|
|
|
|
|
Hi All,
I am access my computer window. when i click on my computer icon than open my computer window but when again click on my computer icon than same window open .My actual problem is , i want to not open same my computer window click on My computer Icon. same window means - first open My computer window content is C: , D: , E: Drive and again open second window content is C: , D: , E: Drive (both my computer window views are same) . I Want to do not open same view of My computer window.
Thanks
Aniruddha
|
|
|
|
|
1) What does this have to do with C#?
2) What do you expect to happen? If you think of the "My Computer" icon as a "door" into the "My Computer" "room", then why would you expect that the first time you open the door, it is "My Bedroom" and the second time it is "My Kitchen"?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Then don't click on it a second time. Why do you believe something different should happen?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
This has absolutely nothing to do with C# or programming in general.
But, what you describe is expected behavior and you can't modify it.
|
|
|
|
|
In a C# 2010 console application it work works fine until it gets to a certain spot. Basically this console application calls another console application.
Here is what is happening:
1. When I run the console application, it runs ok until get reeaches a certain point. At that point is it trying to run the second console application from an directory path I had a week ago. Then I get error messages from the second console application.
2. Also it looks like I am the only person who can run this application. The application starts and never continues for other people.
I am thinking my problem must be in some file in the C# 2010 solution file.
Thus can you tell me what I can do to resolve my problem?
|
|
|
|
|
rachel_m wrote: Thus can you tell me what I can do to resolve my problem? Not without a lot more information. Remember, we cannot see what happens when you run your program, and we have no idea what it is trying to do. At the very least you should show the error message that you receive.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
The error messages says it can not find the specified directory location. However the name of the seond progam that is called is from an old location where the second program used to be at. However that is not the location where I am speficying that the second program should be executed from.
I have no idea how the first program calls the second wrong with the wrong directory path. Do I need to keep the path of the second console application static?
|
|
|
|
|
Rather than paraphrasing what you think is happening, why not show us the exact code that calls the second program, and the exact error message that gets produced. Without specific details of what is going on it is impossible for us to do any more than make guesses.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
There can be any one of a million things wrong. We don't have enough information to tell you anything useful at all.
|
|
|
|
|
The error messages says it can not find the specified directory location. However the name of the second progam that is called is from an old location where the second program used to be at. However that is not the location where I am speficying that the second program should be executed from.
I have no idea how the first program calls the second wrong with the wrong directory path. Do I need to keep the path of the second console application static?
|
|
|
|
|
There still isn't enough information.
From the error message, the path that you supplied to Process to start doesn't exist. Whatever you think it tried to launch is not what's important here. It's what the code thought when it tried to launch this second process.
You have to step through the code in the debugger or instrument the code to log what it's doing and what key variable values are to a file.
|
|
|
|
|
Are you and this person working on the same code? Link
|
|
|
|
|
rachel_m wrote: In a C# 2010 console application it work works fine until it gets to a certain spot. Basically this console application calls another console application.
Here is what is happening:
Probably because of the following
1. You are not doing error checking when you use Process
2. You are making assumptions about the output of the second app which are not true.
|
|
|
|
|
You mentioned the followed:
Probably because of the following
1. You are not doing error checking when you use Process
2. You are making assumptions about the output of the second app which are not true.
I have a try catch block in the code that calls the second application. Is that not enough code. If not, what other error checking do you suggest I use?
You mentioned, " You are making assumptions about the output of the second app which are not true.". Can you tell me what I can do to make certain the second assumption is not true. What do you suggest I do so I do not make any assumptions?
|
|
|
|
|
Your descriptions are not enough. You must show the code!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
 The following is an example of the code I am referring to:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.ComponentModel;
namespace eScripts
{
class Run_e
{
private static String strConsoleAppLocation = "C:\\Program Files (x86)\\coname\\1.exe";
private static String strWebServiceurl = "https://etest//WebService1";
static void Main(string[] args)
{
Process eProcess = new Process();
try
{
String Process_Arguments = null;
eProcess.StartInfo.UseShellExecute = false;
eProcess.StartInfo.FileName = strConsoleAppLocation;
Process_Arguments = strWebServiceurl + " 164 " + cust1";
eProcess.StartInfo.Arguments = Process_Arguments;
eProcess.Start();
eProcess.WaitForExit(1800);
Process_Arguments = null;
eDataContext rptData = new eDataContext();
string[] PkgIDs = rData.Trackings.Where(c => c.Received_Date != null
.Select(c => c.Package_ID).ToArray();
foreach (string PkgID in PkgIDs)
{
String Process1_Arguments = null;
Process Process1 = new Process();
Process1.StartInfo.FileName = strConsoleAppLocation;
Process1_Arguments = strWebServiceurl + " 10 " + PkgID;
Process1.StartInfo.Arguments = Process1_Arguments;
Process1.Start();
Process1.WaitForExit(1800);
Process1.Dispose();
Process1_Arguments = null;
}
ateTime StartDateTime = rData.Trackings.Where(c => c.Error_Report_Date != null).Select(c => c.Error_Report_Date).Max().GetValueOrDefault();
DateTime CurDateTime = DateTime.Now;
string[] AddPkgIDs = (from rData.Trackings.where(c.tNumber.Substring(0, 3) == "dis"
select TNumb).Distinct().ToArray();
if (AddPkgIDs != null)
{
foreach (string AddPkgID in AddPkgIDs)
{
String Process4_Arguments = null;
Process Process4 = new Process();
Process4.StartInfo.FileName = strConsoleAppLocation;
Process4_Arguments = strWebServiceurl + " 14295 " + AddPkgID;
Process4.StartInfo.Arguments = Process4_Arguments;
Process4.Start();
Process4.WaitForExit(1800); //waits 2 minutes
Process4.Dispose();
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
The line of code that says,
private static String strConsoleAppLocation = "C:\\Program Files (x86)\\coname\\1.exe";
was orginally setup to be
private static String strConsoleAppLocation = "C:\\allcustomers\\country\\state\\city\customername\\1.exe";
modified 21-Oct-12 20:02pm.
|
|
|
|
|
In my opinion, you have too much code inside the try block. The error could be anywhere, and all you are seeing is the error message, but not where it is happening.
Remove the try catch blocks and run it again in the debugger. Then you'll find out where the error is happening.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
rachel_m wrote: I have a try catch block in the code that calls the second application.
Process represents a distinct operating system application. There is no way for exceptions to propogate across the process boundary.
However Process methods do have return values. Which you are ignoring.
rachel_m wrote: Can you tell me what I can do to make certain the second assumption is not true
Insure that you can read both zero bytes and a very large number of bytes from stdout and stderr. And if you are not otherwise processing those for specific output then collect it somewhere so you can inspect it for errors and unexpected output.
|
|
|
|
|
whats delegate concept in c# ?
thanks for any simple explain for this concept 
|
|
|
|
|
Whenever you have a question regarding base framework things like this, you should first put that into google and then pick the link to the MSDN documentation. In most cases, this will be one of the first 3 links and is the best documentation to start learning from. Cheers.
Delegates[^]
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
|
You are welcome. Cheers.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Actually that question has been asked here many times, try searching delegates in this forum, you will find many explanations and some of them are more enlightening that the MSDN doco.
I find some forum explanations to be easier to understand than microsofts own interpretation.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi Friends,
I need javascript coding for textbox to allow only alphabets on key press,
provide me solution
Thanks
|
|
|
|